diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -124,9 +124,20 @@ require('lazy').setup({ changedelete = { text = '~' }, }, on_attach = function(bufnr) - vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) + vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) + + -- don't override the built-in and fugitive keymaps + local gs = package.loaded.gitsigns + vim.keymap.set({'n', 'v'}, ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '<Ignore>' + end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) + vim.keymap.set({'n', 'v'}, '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '<Ignore>' + end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) end, }, }, @@ -308,12 +319,13 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) +vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, |