mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-12-27 05:41:45 +00:00
Feat: Simplifying code
This commit is contained in:
parent
187bebcbf9
commit
66dc5b896d
14
init.lua
14
init.lua
@ -110,17 +110,9 @@ require('lazy').setup({
|
|||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local function map(mode, lhs, rhs, opts)
|
vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to [P]revious [H]unk' })
|
||||||
opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
|
vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to [N]ext [H]unk' })
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
||||||
end
|
|
||||||
|
|
||||||
-- Navigation
|
|
||||||
map('n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
|
|
||||||
map('n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
map('n', '<leader>ph', '<cmd>Gitsigns preview_hunk<CR>')
|
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user