From 22945505ed4a3c7d85e2ecbd2a9910d6004ce812 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Fri, 24 Sep 2021 16:37:12 +0700 Subject: [PATCH] neovim: update config for gitsigns.nvim --- home/.config/nvim/lua/mappings.lua | 2 ++ home/.config/nvim/lua/modules/ui.lua | 32 ++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index defd0a6..56cbecd 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -189,7 +189,9 @@ wk.register({ r = 'Reset hunk', R = 'Reset all hunks in buffer', s = 'Stage hunk', + S = 'Stage buffer', u = 'Undo hunk', + U = 'Reset buffer index', n = {':Neogit', 'Neogit'}, f = { name = 'Telescope', diff --git a/home/.config/nvim/lua/modules/ui.lua b/home/.config/nvim/lua/modules/ui.lua index 52b1d41..d8c9667 100644 --- a/home/.config/nvim/lua/modules/ui.lua +++ b/home/.config/nvim/lua/modules/ui.lua @@ -426,11 +426,13 @@ function M.gitsigns_conf() topdelete = {hl = 'DiffDelete', text = '', numhl='GitSignsDeleteNr'}, changedelete = {hl = 'DiffChange', text = '', numhl='GitSignsChangeNr'} }, + signcolumn = false, numhl = true, + linehl = false, + word_diff = false, keymaps = { -- Default keymap options noremap = true, - buffer = true, ['n ]g'] = {expr = true, '&diff ? \']g\' : \'lua require"gitsigns.actions".next_hunk()\''}, ['n [g'] = {expr = true, '&diff ? \'[g\' : \'lua require"gitsigns.actions".prev_hunk()\''}, @@ -442,7 +444,13 @@ function M.gitsigns_conf() ['v gr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', ['n gR'] = 'lua require"gitsigns".reset_buffer()', ['n gp'] = 'lua require"gitsigns".preview_hunk()', - ['n gb'] = 'lua require"gitsigns".blame_line(true)' + ['n gb'] = 'lua require"gitsigns".blame_line(true)', + ['n gS'] = 'lua require"gitsigns".stage_buffer()', + ['n gU'] = 'lua require"gitsigns".reset_buffer_index()', + + -- Text objects + ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', + ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' }, watch_index = { interval = 1000, @@ -454,11 +462,27 @@ function M.gitsigns_conf() virt_text = true, virt_text_pos = 'eol' }, + current_line_blame_formatter_opts = { + relative_time = false + }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default - word_diff = false, - use_internal_diff = true -- If luajit is present + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, + yadm = { + enable = false + }, + diff_opts = { + internal = true -- If luajit is present + } } end