summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/git.lua
blob: 2f9cbc4204b84f259b3d1b8981502b81598dd11d (plain)
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
require('gitsigns').setup {
  signs = {
    add          = {hl = 'GitSignsAdd'   , text = '│', numhl='GitSignsAddNr'   , linehl='GitSignsAddLn'},
    change       = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
    delete       = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
    topdelete    = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
    changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
  },
  keymaps = {
    -- Default keymap options
    noremap = true,

    ['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns.actions\".next_hunk()<CR>'"},
    ['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns.actions\".prev_hunk()<CR>'"},

    ['n hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
    ['v hs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
    ['n hS'] = '<cmd>lua require"gitsigns".stage_buffer()<CR>',
    ['n hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
    ['n hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
    ['n hB'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>',
  },
  signcolumn = true,  -- Toggle with `:Gitsigns toggle_signs`
  numhl      = true, -- Toggle with `:Gitsigns toggle_numhl`
  watch_gitdir = {
    interval = 1000,
    follow_files = true
  },
}