-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathgitsigns.vim
More file actions
36 lines (31 loc) · 789 Bytes
/
gitsigns.vim
File metadata and controls
36 lines (31 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if exists('g:vscode')
finish
endif
if exists('g:plug_installing_plugins')
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'
finish
endif
lua << EOF
require('gitsigns').setup({
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
-- Navigation
map('n', '<leader>gn', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '<leader>gN', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
end
})
EOF