gitsigns.lua (1440B)
1 return { 2 "lewis6991/gitsigns.nvim", 3 config = function() 4 local gitsigns = require("gitsigns") 5 gitsigns.setup({ 6 signs = { 7 add = { text = '░' }, 8 change = { text = '░' }, 9 delete = { text = '░' }, 10 topdelete = { text = '░' }, 11 changedelete = { text = '░' }, 12 untracked = { text = '░' }, 13 }, 14 signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` 15 linehl = false, -- Toggle with `:Gitsigns toggle_linehl` 16 numhl = false, -- Toggle with `:Gitsigns toggle_nunhl` 17 word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` 18 sign_priority = 9, 19 watch_gitdir = { 20 interval = 1000, 21 }, 22 attach_to_untracked = false, 23 on_attach = function(bufnr) 24 local gitsigns = require("gitsigns") 25 local function map(mode, l, r, opts) 26 opts = opts or {} 27 opts.buffer = bufnr 28 vim.keymap.set(mode, l, r, opts) 29 end 30 31 -- navigation 32 map('n', ']c', function() 33 if vim.wo.diff then 34 vim.cmd.normal({']c', bang = true}) 35 else 36 gitsigns.nav_hunk('next') 37 end 38 end) 39 40 map('n', '[c', function() 41 if vim.wo.diff then 42 vim.cmd.normal({'[c', bang = true}) 43 else 44 gitsigns.nav_hunk('prev') 45 end 46 end) 47 end 48 }) 49 -- if pcall(require, "scrollbar") then 50 -- require("scrollbar.handlers.gitsigns").setup() 51 -- end 52 end, 53 event = { "BufReadPre", "BufNewFile" }, 54 }