diff --git a/lua/plugins.lua b/lua/plugins.lua index e4f7df8..f16b360 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -111,7 +111,7 @@ return require("packer").startup( } use { "nvim-telescope/telescope.nvim", - requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}} + requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"} } use { "nacro90/numb.nvim", @@ -126,9 +126,9 @@ return require("packer").startup( end } use { - "tveskag/nvim-blame-line", + "sindrets/diffview.nvim", config = function() - vim.api.nvim_exec([[autocmd BufEnter * EnableBlameLine]], true) + require "plugins/diffview" end } end diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..5b40f87 --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,40 @@ +local cb = require "diffview.config".diffview_callback + +require "diffview".setup { + diff_binaries = false, -- Show diffs for binaries + file_panel = { + width = 35, + use_icons = true -- Requires nvim-web-devicons + }, + key_bindings = { + disable_defaults = false, -- Disable the default key bindings + -- The `view` bindings are active in the diff buffers, only when the current + -- tabpage is a Diffview. + view = { + [""] = cb("select_next_entry"), -- Open the diff for the next file + [""] = cb("select_prev_entry"), -- Open the diff for the previous file + ["e"] = cb("focus_files"), -- Bring focus to the files panel + ["b"] = cb("toggle_files") -- Toggle the files panel. + }, + file_panel = { + ["j"] = cb("next_entry"), -- Bring the cursor to the next file entry + [""] = cb("next_entry"), + ["k"] = cb("prev_entry"), -- Bring the cursor to the previous file entry. + [""] = cb("prev_entry"), + [""] = cb("select_entry"), -- Open the diff for the selected entry. + ["o"] = cb("select_entry"), + ["<2-LeftMouse>"] = cb("select_entry"), + ["-"] = cb("toggle_stage_entry"), -- Stage / unstage the selected entry. + ["S"] = cb("stage_all"), -- Stage all entries. + ["U"] = cb("unstage_all"), -- Unstage all entries. + ["R"] = cb("refresh_files"), -- Update stats and entries in the file list. + [""] = cb("select_next_entry"), + [""] = cb("select_prev_entry"), + ["e"] = cb("focus_files"), + ["b"] = cb("toggle_files") + } + } +} + +vim.api.nvim_set_keymap("n", "g", ":DiffviewOpen", {silent = true}) +vim.api.nvim_set_keymap("n", "G", ":DiffviewClose", {silent = true}) diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 905014a..3965e8a 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -69,6 +69,11 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["diffview.nvim"] = { + config = { "\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21plugins/diffview\frequire\0" }, + loaded = true, + path = "/home/gordon/.local/share/nvim/site/pack/packer/start/diffview.nvim" + }, ["formatter.nvim"] = { config = { "\27LJ\1\0021\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\22plugins/formatter\frequire\0" }, loaded = true, @@ -101,11 +106,6 @@ _G.packer_plugins = { loaded = true, path = "/home/gordon/.local/share/nvim/site/pack/packer/start/nvim-autopairs" }, - ["nvim-blame-line"] = { - config = { "\27LJ\1\2R\0\0\2\1\3\0\6+\0\0\0007\0\0\0007\0\1\0%\1\2\0>\0\2\1G\0\1\0\0\0'autocmd BufEnter * EnableBlameLine\14nvim_exec\bapi\0" }, - loaded = true, - path = "/home/gordon/.local/share/nvim/site/pack/packer/start/nvim-blame-line" - }, ["nvim-colorizer.lua"] = { config = { "\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0" }, loaded = true, @@ -183,22 +183,22 @@ time([[Config for formatter.nvim]], false) time([[Config for nvim-treesitter]], true) try_loadstring("\27LJ\1\2œ\2\0\0\3\0\14\0\0214\0\0\0%\1\1\0>\0\2\0027\0\2\0003\1\3\0>\0\2\0014\0\0\0%\1\4\0>\0\2\0027\0\2\0003\1\6\0003\2\5\0:\2\a\0013\2\b\0:\2\t\0013\2\n\0:\2\v\0013\2\f\0:\2\r\1>\0\2\1G\0\1\0\fautotag\1\0\1\venable\2\vindent\1\0\1\venable\2\14highlight\1\0\1\venable\2\26context_commentstring\1\0\0\1\0\2\19enable_autocmd\2\venable\2\28nvim-treesitter.configs\1\0\1\30enable_check_bracket_line\2\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-treesitter") time([[Config for nvim-treesitter]], false) --- Config for: nvim-colorizer.lua -time([[Config for nvim-colorizer.lua]], true) -try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua") -time([[Config for nvim-colorizer.lua]], false) --- Config for: nvim-compe -time([[Config for nvim-compe]], true) -try_loadstring("\27LJ\1\2-\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\18plugins/compe\frequire\0", "config", "nvim-compe") -time([[Config for nvim-compe]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +try_loadstring("\27LJ\1\0021\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\22plugins/nvim-tree\frequire\0", "config", "nvim-tree.lua") +time([[Config for nvim-tree.lua]], false) +-- Config for: diffview.nvim +time([[Config for diffview.nvim]], true) +try_loadstring("\27LJ\1\0020\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\21plugins/diffview\frequire\0", "config", "diffview.nvim") +time([[Config for diffview.nvim]], false) -- Config for: numb.nvim time([[Config for numb.nvim]], true) try_loadstring("\27LJ\1\0022\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\tnumb\frequire\0", "config", "numb.nvim") time([[Config for numb.nvim]], false) --- Config for: nvim-blame-line -time([[Config for nvim-blame-line]], true) -try_loadstring("\27LJ\1\2R\0\0\2\1\3\0\6+\0\0\0007\0\0\0007\0\1\0%\1\2\0>\0\2\1G\0\1\0\0\0'autocmd BufEnter * EnableBlameLine\14nvim_exec\bapi\0", "config", "nvim-blame-line") -time([[Config for nvim-blame-line]], false) +-- Config for: nvim-compe +time([[Config for nvim-compe]], true) +try_loadstring("\27LJ\1\2-\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\18plugins/compe\frequire\0", "config", "nvim-compe") +time([[Config for nvim-compe]], false) -- Config for: vim-signify time([[Config for vim-signify]], true) try_loadstring("\27LJ\1\2/\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\20plugins/signify\frequire\0", "config", "vim-signify") @@ -215,10 +215,10 @@ time([[Config for galaxyline.nvim]], false) time([[Config for nvim-lspconfig]], true) try_loadstring("\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16plugins/lsp\frequire\0", "config", "nvim-lspconfig") time([[Config for nvim-lspconfig]], false) --- Config for: nvim-tree.lua -time([[Config for nvim-tree.lua]], true) -try_loadstring("\27LJ\1\0021\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\22plugins/nvim-tree\frequire\0", "config", "nvim-tree.lua") -time([[Config for nvim-tree.lua]], false) +-- Config for: nvim-colorizer.lua +time([[Config for nvim-colorizer.lua]], true) +try_loadstring("\27LJ\1\0027\0\0\2\0\3\0\0064\0\0\0%\1\1\0>\0\2\0027\0\2\0>\0\1\1G\0\1\0\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua") +time([[Config for nvim-colorizer.lua]], false) if should_profile then save_profiles() end end)