| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- require('gitsigns').setup({
- signs = {
- add = { text = '+' },
- change = { text = '~' },
- delete = { text = '_' },
- topdelete = { text = '‾' },
- changedelete = { text = '~' },
- untracked = { text = '┆' },
- },
- -- Enable highlighting for the sign column and line numbers
- signcolumn = true,
- numhl = true,
- linehl = false,
- word_diff = false,
-
- 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', ']h', function()
- if vim.wo.diff then return ']h' end
- vim.schedule(function() gs.next_hunk() end)
- return '<Ignore>'
- end, {expr=true})
- map('n', '[h', function()
- if vim.wo.diff then return '[h' end
- vim.schedule(function() gs.prev_hunk() end)
- return '<Ignore>'
- end, {expr=true})
- -- Actions
- map('n', '<leader>hs', gs.stage_hunk)
- map('n', '<leader>hr', gs.reset_hunk)
- map('n', '<leader>hp', gs.preview_hunk)
- map('n', '<leader>hb', function() gs.blame_line{full=true} end)
- end
- })
|