gitsigns configured
This commit is contained in:
parent
b3f4e6badb
commit
e10cff79d8
|
|
@ -233,11 +233,11 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date.
|
||||||
- [x] Decision: Skip markdown rendering plugins entirely
|
- [x] Decision: Skip markdown rendering plugins entirely
|
||||||
|
|
||||||
## Phase 7.2 — Gitsigns
|
## Phase 7.2 — Gitsigns
|
||||||
- [ ] Add `lewis6991/gitsigns.nvim`
|
- [x] Add `lewis6991/gitsigns.nvim`
|
||||||
- [ ] Configure signs in gutter (add, change, delete, topdelete, changedelete)
|
- [x] Configure signs in gutter (add, change, delete, topdelete, changedelete)
|
||||||
- [ ] Add hunk navigation keymaps (]h/[h for next/prev hunk)
|
- [x] Add hunk navigation keymaps (]h/[h for next/prev hunk)
|
||||||
- [ ] Add hunk action keymaps (stage, reset, preview)
|
- [x] Add hunk action keymaps (stage, reset, preview)
|
||||||
- [ ] Keep minimal - no inline blame, no advanced features
|
- [x] Keep minimal - no inline blame, no advanced features
|
||||||
|
|
||||||
## Phase 8 — Copilot
|
## Phase 8 — Copilot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
-- Gitsigns: Git integration with signs in gutter and hunk operations
|
||||||
|
return {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
event = { 'BufReadPre', 'BufNewFile' },
|
||||||
|
opts = {
|
||||||
|
signs = {
|
||||||
|
add = { text = '+' },
|
||||||
|
change = { text = '~' },
|
||||||
|
delete = { text = '_' },
|
||||||
|
topdelete = { text = '‾' },
|
||||||
|
changedelete = { text = '~' },
|
||||||
|
untracked = { text = '┆' },
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Show signs in signcolumn
|
||||||
|
numhl = false, -- Don't highlight line numbers
|
||||||
|
linehl = false, -- Don't highlight lines
|
||||||
|
word_diff = false, -- Don't show word diff
|
||||||
|
current_line_blame = false, -- No inline blame
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Hunk navigation
|
||||||
|
map('n', ']h', function()
|
||||||
|
if vim.wo.diff then return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true, desc = 'Next hunk' })
|
||||||
|
|
||||||
|
map('n', '[h', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true, desc = 'Previous hunk' })
|
||||||
|
|
||||||
|
-- Hunk actions
|
||||||
|
map('n', '<leader>hs', gs.stage_hunk, { desc = 'Stage hunk' })
|
||||||
|
map('n', '<leader>hr', gs.reset_hunk, { desc = 'Reset hunk' })
|
||||||
|
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Stage hunk' })
|
||||||
|
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, { desc = 'Reset hunk' })
|
||||||
|
map('n', '<leader>hS', gs.stage_buffer, { desc = 'Stage buffer' })
|
||||||
|
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'Undo stage hunk' })
|
||||||
|
map('n', '<leader>hR', gs.reset_buffer, { desc = 'Reset buffer' })
|
||||||
|
map('n', '<leader>hp', gs.preview_hunk, { desc = 'Preview hunk' })
|
||||||
|
map('n', '<leader>hd', gs.diffthis, { desc = 'Diff this' })
|
||||||
|
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'Diff this ~' })
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Select hunk' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue