From 21167993bf8b336f21973a612eaa05ceede3824e Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 27 Oct 2020 21:31:11 +0530 Subject: [PATCH] nvim: Use gitsigns Currently there is an observable bug where this doesn't play well with gina buffers. Perhaps it should be disabled for any gina buffers or something similar. --- nvim/.config/nvim/lua/init.lua | 1 + nvim/.config/nvim/lua/modules/gitsigns.lua | 19 +++++++++++++++++++ nvim/.config/nvim/lua/plugins.lua | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 nvim/.config/nvim/lua/modules/gitsigns.lua diff --git a/nvim/.config/nvim/lua/init.lua b/nvim/.config/nvim/lua/init.lua index 28204e0..a2b85c4 100644 --- a/nvim/.config/nvim/lua/init.lua +++ b/nvim/.config/nvim/lua/init.lua @@ -113,6 +113,7 @@ require 'modules.diagnostic' require 'modules.floaterm' require 'modules.fzf' require 'modules.fzf-preview' +require 'modules.gitsigns' require 'modules.sneak' require 'modules.togglelist' require 'modules.which_key' diff --git a/nvim/.config/nvim/lua/modules/gitsigns.lua b/nvim/.config/nvim/lua/modules/gitsigns.lua new file mode 100644 index 0000000..dcacec4 --- /dev/null +++ b/nvim/.config/nvim/lua/modules/gitsigns.lua @@ -0,0 +1,19 @@ +require('gitsigns').setup { + signs = { + add = {hl = 'DiffAdd' , text = '+'}, + change = {hl = 'DiffChange', text = '!'}, + delete = {hl = 'DiffDelete', text = 'x'}, + topdelete = {hl = 'DiffDelete', text = '-'}, + changedelete = {hl = 'DiffChange', text = '~'}, + }, + keymaps = { + [']c'] = 'lua require("gitsigns").next_hunk()', + ['[c'] = 'lua require("gitsigns").prev_hunk()', + ['ghs'] = 'lua require("gitsigns").stage_hunk()', + ['ghu'] = 'lua require("gitsigns").undo_stage_hunk()', + ['ghr'] = 'lua require("gitsigns").reset_hunk()', + }, + watch_index = { + interval = 1000 + } +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 0228420..4872c19 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -20,6 +20,8 @@ paq 'steelsojka/completion-buffers' -- For tmux paq 'tmux-plugins/vim-tmux-focus-events' -- Git support +paq 'nvim-lua/plenary.nvim' +paq 'lewis6991/gitsigns.nvim' paq 'lambdalisue/gina.vim' paq 'rhysd/git-messenger.vim' paq 'rhysd/conflict-marker.vim'