From 2038eb9f872797f857411d5c42aff8eb6a7a3020 Mon Sep 17 00:00:00 2001 From: Marco Dalla Stella Date: Fri, 2 Jan 2026 19:20:38 +0100 Subject: [PATCH] Add neogit and gitsigns --- plugin/20_keymaps.lua | 23 +++++------------------ plugin/30_mini.lua | 33 +++++++++------------------------ plugin/40_plugins.lua | 22 ++++++++++++++-------- 3 files changed, 28 insertions(+), 50 deletions(-) diff --git a/plugin/20_keymaps.lua b/plugin/20_keymaps.lua index 87d551d..0d8579e 100644 --- a/plugin/20_keymaps.lua +++ b/plugin/20_keymaps.lua @@ -146,6 +146,11 @@ nmap_leader('fS', 'Pick lsp scope="document_symbol"', 'Symbols documen nmap_leader('fv', 'Pick visit_paths cwd=""', 'Visit paths (all)') nmap_leader('fV', 'Pick visit_paths', 'Visit paths (cwd)') +-- g is for Git +nmap_leader('gg', 'Neogit', 'Open neogit') +nmap_leader('gb', 'Gitsigns toggle_current_line_blame', 'Git blame') + + -- l is for 'Language'. Common usage: -- - `ld` - show more diagnostic details in a floating window -- - `lr` - perform rename via LSP @@ -198,22 +203,4 @@ nmap_leader('sw', 'lua MiniSessions.write()', 'Write current') nmap_leader('tT', 'horizontal term', 'Terminal (horizontal)') nmap_leader('tt', 'vertical term', 'Terminal (vertical)') --- v is for 'Visits'. Common usage: --- - `vv` - add "core" label to current file. --- - `vV` - remove "core" label to current file. --- - `vc` - pick among all files with "core" label. -local make_pick_core = function(cwd, desc) - return function() - local sort_latest = MiniVisits.gen_sort.default({ recency_weight = 1 }) - local local_opts = { cwd = cwd, filter = 'core', sort = sort_latest } - MiniExtra.pickers.visit_paths(local_opts, { source = { name = desc } }) - end -end - -nmap_leader('vc', make_pick_core('', 'Core visits (all)'), 'Core visits (all)') -nmap_leader('vC', make_pick_core(nil, 'Core visits (cwd)'), 'Core visits (cwd)') -nmap_leader('vv', 'lua MiniVisits.add_label("core")', 'Add "core" label') -nmap_leader('vV', 'lua MiniVisits.remove_label("core")', 'Remove "core" label') -nmap_leader('vl', 'lua MiniVisits.add_label()', 'Add label') -nmap_leader('vL', 'lua MiniVisits.remove_label()', 'Remove label') -- stylua: ignore end diff --git a/plugin/30_mini.lua b/plugin/30_mini.lua index 442871f..104e265 100644 --- a/plugin/30_mini.lua +++ b/plugin/30_mini.lua @@ -291,22 +291,6 @@ later(function() vim.lsp.config('*', { capabilities = MiniCompletion.get_lsp_capabilities() }) end) --- Work with diff hunks that represent the difference between the buffer text and --- some reference text set by a source. Default source uses text from Git index. --- Also provides summary info used in developer section of 'mini.statusline'. --- Example usage: --- - `ghip` - apply hunks (`gh`) within *i*nside *p*aragraph --- - `gHG` - reset hunks (`gH`) from cursor until end of buffer (`G`) --- - `ghgh` - apply (`gh`) hunk at cursor (`gh`) --- - `gHgh` - reset (`gH`) hunk at cursor (`gh`) --- - `go` - toggle overlay --- --- See also: --- - `:h MiniDiff-overview` - overview of how module works --- - `:h MiniDiff-diff-summary` - available summary information --- - `:h MiniDiff.gen_source` - available built-in sources -later(function() require('mini.diff').setup() end) - -- Navigate and manipulate file system -- -- See also: @@ -360,13 +344,15 @@ end) -- -- See also: -- - `:h MiniIndentscope.gen_animation` - available animation rules -later(function() require('mini.indentscope').setup( - { - draw = { - animation = require('mini.indentscope').gen_animation.none() - } - } -) end) +later( + function() + require('mini.indentscope').setup({ + draw = { + animation = require('mini.indentscope').gen_animation.none(), + }, + }) + end +) -- Jump within visible lines to pre-defined spots via iterative label filtering. -- See also: @@ -525,4 +511,3 @@ later(function() require('mini.surround').setup() end) -- to reduce noise when typing. Example usage: -- - `ot` - trim all trailing whitespace in a buffer later(function() require('mini.trailspace').setup() end) - diff --git a/plugin/40_plugins.lua b/plugin/40_plugins.lua index bc35234..d6b37cc 100644 --- a/plugin/40_plugins.lua +++ b/plugin/40_plugins.lua @@ -115,19 +115,25 @@ MiniDeps.now(function() require('catppuccin').setup({ flavour = 'mocha', dim_inactive = { - enabled = true - } + enabled = true, + }, }) vim.cmd('colorscheme catppuccin') end) -- Neogit ===================================================================== -later(function () - add({ +later(function() + add({ source = 'NeogitOrg/neogit', - depends = { 'nvim-lua/plenary.nvim' } + depends = { 'nvim-lua/plenary.nvim' }, }) - local neogit = require('neogit') - neogit.setup() - vim.keymap.set("n", "gg", neogit.open, { desc = "Open Neogit UI" }) + require('neogit').setup() +end) + +-- Gitsigns =================================================================== +later(function() + add({ + source = 'lewis6991/gitsigns.nvim', + }) + require('gitsigns').setup({}) end)