added DiffView

This commit is contained in:
MasterGordon 2021-07-25 16:44:52 +02:00
parent bfb2c3e59d
commit a4094e5d65
3 changed files with 64 additions and 24 deletions

View File

@ -111,7 +111,7 @@ return require("packer").startup(
} }
use { use {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}} requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"}
} }
use { use {
"nacro90/numb.nvim", "nacro90/numb.nvim",
@ -126,9 +126,9 @@ return require("packer").startup(
end end
} }
use { use {
"tveskag/nvim-blame-line", "sindrets/diffview.nvim",
config = function() config = function()
vim.api.nvim_exec([[autocmd BufEnter * EnableBlameLine]], true) require "plugins/diffview"
end end
} }
end end

40
lua/plugins/diffview.lua Normal file
View File

@ -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 = {
["<tab>"] = cb("select_next_entry"), -- Open the diff for the next file
["<s-tab>"] = cb("select_prev_entry"), -- Open the diff for the previous file
["<leader>e"] = cb("focus_files"), -- Bring focus to the files panel
["<leader>b"] = cb("toggle_files") -- Toggle the files panel.
},
file_panel = {
["j"] = cb("next_entry"), -- Bring the cursor to the next file entry
["<down>"] = cb("next_entry"),
["k"] = cb("prev_entry"), -- Bring the cursor to the previous file entry.
["<up>"] = cb("prev_entry"),
["<cr>"] = 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.
["<tab>"] = cb("select_next_entry"),
["<s-tab>"] = cb("select_prev_entry"),
["<leader>e"] = cb("focus_files"),
["<leader>b"] = cb("toggle_files")
}
}
}
vim.api.nvim_set_keymap("n", "<leader>g", ":DiffviewOpen<CR>", {silent = true})
vim.api.nvim_set_keymap("n", "<leader>G", ":DiffviewClose<CR>", {silent = true})

View File

@ -69,6 +69,11 @@ end
time([[try_loadstring definition]], false) time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true) time([[Defining packer_plugins]], true)
_G.packer_plugins = { _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"] = { ["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" }, 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, loaded = true,
@ -101,11 +106,6 @@ _G.packer_plugins = {
loaded = true, loaded = true,
path = "/home/gordon/.local/share/nvim/site/pack/packer/start/nvim-autopairs" 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"] = { ["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" }, 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, loaded = true,
@ -183,22 +183,22 @@ time([[Config for formatter.nvim]], false)
time([[Config for nvim-treesitter]], true) 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") 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) time([[Config for nvim-treesitter]], false)
-- Config for: nvim-colorizer.lua -- Config for: nvim-tree.lua
time([[Config for nvim-colorizer.lua]], true) time([[Config for nvim-tree.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") 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-colorizer.lua]], false) time([[Config for nvim-tree.lua]], false)
-- Config for: nvim-compe -- Config for: diffview.nvim
time([[Config for nvim-compe]], true) time([[Config for diffview.nvim]], 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") 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 nvim-compe]], false) time([[Config for diffview.nvim]], false)
-- Config for: numb.nvim -- Config for: numb.nvim
time([[Config for numb.nvim]], true) 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") 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) time([[Config for numb.nvim]], false)
-- Config for: nvim-blame-line -- Config for: nvim-compe
time([[Config for nvim-blame-line]], true) time([[Config for nvim-compe]], 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") 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-blame-line]], false) time([[Config for nvim-compe]], false)
-- Config for: vim-signify -- Config for: vim-signify
time([[Config for vim-signify]], true) 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") 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) 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") 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) time([[Config for nvim-lspconfig]], false)
-- Config for: nvim-tree.lua -- Config for: nvim-colorizer.lua
time([[Config for nvim-tree.lua]], true) time([[Config for nvim-colorizer.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") 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-tree.lua]], false) time([[Config for nvim-colorizer.lua]], false)
if should_profile then save_profiles() end if should_profile then save_profiles() end
end) end)