Fix leader binding

This commit is contained in:
thomas-gideon-gm 2024-08-23 13:57:10 -04:00
parent 372846fa2f
commit 5025818b98

View file

@ -12,8 +12,7 @@ vim.opt.shortmess:append('c')
-- extend timeout to allow time for three character shortcuts -- extend timeout to allow time for three character shortcuts
vim.opt.timeoutlen = 2500 vim.opt.timeoutlen = 2500
local bufnr = vim.api.nvim_get_current_buf() local opts = { noremap = true, silent = true }
local opts = { buffer = bufnr, noremap = true, silent = true }
-- toggle gundo's display -- toggle gundo's display
vim.keymap.set('n', '<F5>', vim.cmd.UndotreeToggle) vim.keymap.set('n', '<F5>', vim.cmd.UndotreeToggle)
@ -25,23 +24,24 @@ vim.cmd("tnoremap <C-Space><Esc> <C-\\><C-n>")
-- Code navigation shortcuts -- Code navigation shortcuts
-- from https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua#L34 -- from https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua#L34
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', '<Leader>ga', vim.lsp.buf.code_action)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts) vim.keymap.set('n', '<Leader>gi', vim.lsp.buf.implementation)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts) -- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts) -- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<Leader>wl', function() vim.keymap.set('n', '<Leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts) end, opts)
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition)
vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', '<Leader>nr', vim.lsp.buf.rename)
vim.keymap.set('n', '<Leader>gr', vim.lsp.buf.references, opts) vim.keymap.set('n', '<Leader>gr', vim.lsp.buf.references)
vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist, opts) vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist)
vim.keymap.set('n', '<Leader>xx', vim.cmd.TroubleToggle, opts) vim.keymap.set('n', '<Leader>xx', vim.cmd.TroubleToggle, opts)