diff --git a/neovim/config/plugins/diffview.lua b/neovim/config/plugins/diffview.lua new file mode 100644 index 0000000..f9630bb --- /dev/null +++ b/neovim/config/plugins/diffview.lua @@ -0,0 +1,12 @@ +vim.pack.add({ 'https://github.com/sindrets/diffview.nvim' }) + +require('diffview').setup() + +local function map(lhs, rhs, desc) + vim.keymap.set('n', lhs, rhs, { desc = desc }) +end + +map('gd', 'DiffviewOpen', 'Diff against index') +map('gc', 'DiffviewClose', 'Close diff view') +map('gh', 'DiffviewFileHistory %', 'File history') +map('gH', 'DiffviewFileHistory', 'Branch history') diff --git a/neovim/config/plugins/init.lua b/neovim/config/plugins/init.lua index 708bbb7..fc2c8eb 100644 --- a/neovim/config/plugins/init.lua +++ b/neovim/config/plugins/init.lua @@ -1,3 +1,4 @@ +require('config.plugins.diffview') require('config.plugins.fzf-lua') require('config.plugins.gitsigns') require('config.plugins.nvim-tree') diff --git a/neovim/config/plugins/which-key.lua b/neovim/config/plugins/which-key.lua index 634bd35..a663754 100644 --- a/neovim/config/plugins/which-key.lua +++ b/neovim/config/plugins/which-key.lua @@ -8,6 +8,7 @@ wk.setup() wk.add({ { 'd', group = 'diagnostics' }, { 'f', group = 'find' }, + { 'g', group = 'diff' }, { 'h', group = 'hunks' }, { 't', group = 'toggles' }, }) diff --git a/neovim/nvim-pack-lock.json b/neovim/nvim-pack-lock.json index 02bc8b6..335a0f8 100644 --- a/neovim/nvim-pack-lock.json +++ b/neovim/nvim-pack-lock.json @@ -1,5 +1,9 @@ { "plugins": { + "diffview.nvim": { + "rev": "4516612fe98ff56ae0415a259ff6361a89419b0a", + "src": "https://github.com/sindrets/diffview.nvim" + }, "fzf-lua": { "rev": "8671012a7b2a1648595952c655039d51fb301c14", "src": "https://github.com/ibhagwan/fzf-lua" diff --git a/tmux b/tmux index 49182f0..45329ff 100644 --- a/tmux +++ b/tmux @@ -14,6 +14,10 @@ set -g renumber-windows on # don't detach when closing a window if other windows remain set -g detach-on-destroy off +# prompt for a name and create a session in one step, instead of +# ` :` then `new -s name` +bind-key S command-prompt -p "New session name:" "new-session -s '%%'" + # reload config file (change file location to your the tmux.conf you want to use) unbind r bind r source-file ~/.tmux.conf @@ -51,5 +55,7 @@ set-hook -g client-dark-theme 'source-file ~/.tmux-dark.conf' # client attaches. Sourcing is idempotent, so the overlap is harmless. set-hook -g client-attached 'if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"' -# Default before any client has attached and reported a theme. -source-file ~/.tmux-dark.conf +# Default before any client has attached and reported a theme. This also +# runs on manual reload (`r` below), so check the invoking client's theme +# rather than always falling back to dark and clobbering a light session. +if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"