From c781b15582fa593a6424c766d72859c58665a0a4 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 23 Sep 2021 11:02:14 +0530 Subject: [PATCH] nvim: Drop signify and switch to gitsigns signify seems to be giving an error after somewhat long usage of "E489: too many highlight and syntax groups". --- nvim/.config/nvim/after/plugin/gitsigns.lua | 65 +++++++++++++++++++++ nvim/.config/nvim/after/plugin/signify.lua | 12 ---- nvim/.config/nvim/lua/plugins.lua | 2 +- 3 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 nvim/.config/nvim/after/plugin/gitsigns.lua delete mode 100644 nvim/.config/nvim/after/plugin/signify.lua diff --git a/nvim/.config/nvim/after/plugin/gitsigns.lua b/nvim/.config/nvim/after/plugin/gitsigns.lua new file mode 100644 index 0000000..e4073de --- /dev/null +++ b/nvim/.config/nvim/after/plugin/gitsigns.lua @@ -0,0 +1,65 @@ +require('gitsigns').setup { + status_formatter = nil, + sign_priority = 6, + update_debounce = 100, + max_file_length = 10000, + signcolumn = true, + numhl = false, + linehl = false, + word_diff = false, + attach_to_untracked = false, + current_line_blame = false, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + }, + watch_gitdir = { + interval = 1000, + follow_files = true + }, + current_line_blame_formatter_opts = { + relative_time = false + }, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, + signs = { + add = { hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn' }, + change = { hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' }, + delete = { hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' }, + topdelete = { hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' }, + changedelete = { hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' }, + }, + keymaps = { + noremap = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'" }, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'" }, + + ['n hl'] = 'lua require"gitsigns".setloclist()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hq'] = 'lua require"gitsigns".setqflist()', + ['n hQ'] = 'lua require"gitsigns".setqflist("attached")', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['v hr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hR'] = 'lua require"gitsigns".reset_buffer()', + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hS'] = 'lua require"gitsigns".stage_buffer()', + ['n ht'] = 'lua require"gitsigns".toggle_signs()', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hU'] = 'lua require"gitsigns".reset_buffer_index()', + + ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', + ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' + }, +} diff --git a/nvim/.config/nvim/after/plugin/signify.lua b/nvim/.config/nvim/after/plugin/signify.lua deleted file mode 100644 index fdbe302..0000000 --- a/nvim/.config/nvim/after/plugin/signify.lua +++ /dev/null @@ -1,12 +0,0 @@ -local remap = vim.api.nvim_set_keymap - -remap('n', 'ghr', ':SignifyHunkUndo', { noremap = true }) -remap('n', 'ghp', ':SignifyHunkDiff', { noremap = true }) -remap('n', ']c', '(signify-next-hunk)', { noremap = false }) -remap('n', '[c', '(signify-prev-hunk)', { noremap = false }) -remap('n', ']C', '9999]c', { noremap = false }) -remap('n', '[C', '9999[c', { noremap = false }) -remap('o', 'ih', '(signify-motion-inner-pending)', { noremap = false }) -remap('x', 'ih', '(signify-motion-inner-visual)', { noremap = false }) -remap('o', 'ah', '(signify-motion-outer-pending)', { noremap = false }) -remap('x', 'ah', '(signify-motion-outer-visual)', { noremap = false }) diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 58fe407..8862d32 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -21,7 +21,7 @@ local init = function () -- For autocompletion use 'hrsh7th/nvim-compe' -- Git support - use 'mhinz/vim-signify' + use 'lewis6991/gitsigns.nvim' use 'tpope/vim-fugitive' use 'rhysd/git-messenger.vim' use 'whiteinge/diffconflicts'