mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-16 07:26:46 +00:00
49
nvim.bak/lua/plugins/gitsigns.lua
Normal file
49
nvim.bak/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
event = 'VeryLazy',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '▌' },
|
||||
change = { text = '▌' },
|
||||
delete = { text = '▌' },
|
||||
topdelete = { text = '▌' },
|
||||
changedelete = { text = '▌' },
|
||||
},
|
||||
word_diff = false,
|
||||
current_line_blame = true,
|
||||
linehl = true,
|
||||
numhl = true,
|
||||
sign_priority = 6,
|
||||
preview_config = {
|
||||
border = 'rounded',
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
local gs = package.loaded.gitsigns
|
||||
map('n', '<leader>hs', gs.stage_hunk)
|
||||
map('n', '<leader>hr', gs.reset_hunk)
|
||||
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
|
||||
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
|
||||
map('n', '<leader>hp', gs.preview_hunk)
|
||||
map('n', '<leader>hd', gs.diffthis)
|
||||
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true })
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user