Add neogit and gitsigns

This commit is contained in:
MDS
2026-01-02 19:20:38 +01:00
parent db7dd381ff
commit 2038eb9f87
3 changed files with 28 additions and 50 deletions

View File

@@ -146,6 +146,11 @@ nmap_leader('fS', '<Cmd>Pick lsp scope="document_symbol"<CR>', 'Symbols documen
nmap_leader('fv', '<Cmd>Pick visit_paths cwd=""<CR>', 'Visit paths (all)')
nmap_leader('fV', '<Cmd>Pick visit_paths<CR>', 'Visit paths (cwd)')
-- g is for Git
nmap_leader('gg', '<Cmd>Neogit<CR>', 'Open neogit')
nmap_leader('gb', '<Cmd>Gitsigns toggle_current_line_blame<CR>', 'Git blame')
-- l is for 'Language'. Common usage:
-- - `<Leader>ld` - show more diagnostic details in a floating window
-- - `<Leader>lr` - perform rename via LSP
@@ -198,22 +203,4 @@ nmap_leader('sw', '<Cmd>lua MiniSessions.write()<CR>', 'Write current')
nmap_leader('tT', '<Cmd>horizontal term<CR>', 'Terminal (horizontal)')
nmap_leader('tt', '<Cmd>vertical term<CR>', 'Terminal (vertical)')
-- v is for 'Visits'. Common usage:
-- - `<Leader>vv` - add "core" label to current file.
-- - `<Leader>vV` - remove "core" label to current file.
-- - `<Leader>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', '<Cmd>lua MiniVisits.add_label("core")<CR>', 'Add "core" label')
nmap_leader('vV', '<Cmd>lua MiniVisits.remove_label("core")<CR>', 'Remove "core" label')
nmap_leader('vl', '<Cmd>lua MiniVisits.add_label()<CR>', 'Add label')
nmap_leader('vL', '<Cmd>lua MiniVisits.remove_label()<CR>', 'Remove label')
-- stylua: ignore end

View File

@@ -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`)
-- - `<Leader>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(
{
later(
function()
require('mini.indentscope').setup({
draw = {
animation = require('mini.indentscope').gen_animation.none()
}
}
) end)
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:
-- - `<Leader>ot` - trim all trailing whitespace in a buffer
later(function() require('mini.trailspace').setup() end)

View File

@@ -115,8 +115,8 @@ MiniDeps.now(function()
require('catppuccin').setup({
flavour = 'mocha',
dim_inactive = {
enabled = true
}
enabled = true,
},
})
vim.cmd('colorscheme catppuccin')
end)
@@ -125,9 +125,15 @@ end)
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", "<leader>gg", neogit.open, { desc = "Open Neogit UI" })
require('neogit').setup()
end)
-- Gitsigns ===================================================================
later(function()
add({
source = 'lewis6991/gitsigns.nvim',
})
require('gitsigns').setup({})
end)