nvim: Set up gitsigns mappings

This commit is contained in:
Marty Oehme 2023-03-23 08:29:12 +01:00
parent d2e101b822
commit 3a6c7717c8
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 48 additions and 43 deletions

View file

@ -1,40 +1,44 @@
-- require('gitsigns').setup { require('gitsigns').setup {
-- on_attach = function(bufnr) numhl = true,
-- local gs = package.loaded.gitsigns signcolumn = false,
-- on_attach = function(bufnr)
-- local function map(mode, l, r, opts) local gs = package.loaded.gitsigns
-- opts = opts or {}
-- opts.buffer = bufnr local function map(mode, l, r, opts)
-- vim.keymap.set(mode, l, r, opts) opts = opts or {}
-- end opts.buffer = bufnr
-- vim.keymap.set(mode, l, r, opts)
-- -- Navigation end
-- map('n', ']h', function()
-- if vim.wo.diff then return ']h' end -- Navigation
-- vim.schedule(function() gs.next_hunk() end) map('n', ']h', function()
-- return '<Ignore>' if vim.wo.diff then return ']h' end
-- end, {expr = true}) vim.schedule(function() gs.next_hunk() end)
-- return '<Ignore>'
-- map('n', '[h', function() end, { expr = true })
-- if vim.wo.diff then return '[h' end
-- vim.schedule(function() gs.prev_hunk() end) map('n', '[h', function()
-- return '<Ignore>' if vim.wo.diff then return '[h' end
-- end, {expr = true}) vim.schedule(function() gs.prev_hunk() end)
-- return '<Ignore>'
-- -- Actions end, { expr = true })
-- map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
-- map('n', '<leader>hS', gs.stage_buffer) -- Actions
-- map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>') require('which-key').register({ ['<localleader>h'] = { name = '+git' } })
-- map('n', '<leader>hR', gs.reset_buffer) map({ 'n', 'v' }, '<localleader>hs', ':Gitsigns stage_hunk<CR>', { desc = 'stage hunk' })
-- map('n', '<leader>hu', gs.undo_stage_hunk) map({ 'n', 'v' }, '<localleader>hr', ':Gitsigns reset_hunk<CR>', { desc = 'reset hunk' })
-- map('n', '<leader>hp', gs.preview_hunk) map('n', '<localleader>hS', gs.stage_buffer, { desc = 'stage buffer' })
-- map('n', '<leader>hb', function() gs.blame_line {full = true} end) map('n', '<localleader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
-- map('n', '<leader>hB', gs.toggle_current_line_blame) map('n', '<localleader>hR', gs.reset_buffer, { desc = 'reset buffer' })
-- map('n', '<leader>hd', gs.diffthis) map('n', '<localleader>hp', gs.preview_hunk, { desc = 'preview hunk' })
-- map('n', '<leader>hD', function() gs.diffthis('~') end) map('n', '<localleader>hb', function() gs.blame_line { full = true } end, { desc = 'blame line' })
-- map('n', '<leader>hdd', gs.toggle_deleted) map('n', '<localleader>hB', gs.toggle_current_line_blame, { desc = 'toggle blame' })
-- map('n', '<localleader>hd', gs.diffthis, { desc = 'diffthis' })
-- -- Text object map('n', '<localleader>hD', function() gs.diffthis('~') end, { desc = 'diffbase' })
-- map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>') map('n', '<localleader>ht', gs.toggle_deleted, { desc = 'toggle deleted' })
-- end
-- } -- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
map({ 'o', 'x' }, 'ah', ':<C-U>Gitsigns select_hunk<CR>')
end
}

View file

@ -8,10 +8,11 @@ return {
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak { 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
{ {
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter 'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
opts = { numhl = true, signcolumn = false }, config = function()
require('plug._gitsigns')
end,
event = "BufRead" event = "BufRead"
}, }, { "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
{ "m4xshen/smartcolumn.nvim", config = true }, -- auto-hiding colorcolumn
-- files -- files
{ 'vifm/vifm.vim' }, -- integrate file manager { 'vifm/vifm.vim' }, -- integrate file manager
{ {