diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 1b03dfb..15fe505 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -1,4 +1,4 @@ -local map = vim.api.nvim_set_keymap +local map = vim.keymap.set -- Avoid infinitely recursive definitions options = { noremap = true } @@ -62,18 +62,18 @@ local on_attach = function(client, bufnr) local opts = { noremap=true, silent=true } - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', options) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', options) - buf_set_keymap('n', 'k', 'lua vim.lsp.buf.hover()', options) - buf_set_keymap('n', 's', 'lua vim.lsp.buf.signature_help()', options) - buf_set_keymap('n', 'r', 'lua vim.lsp.buf.rename()', options) - buf_set_keymap('n', 'a', 'lua vim.lsp.buf.code_action()', { noremap = true }) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', options) - buf_set_keymap('n', 'd', 'lua vim.lsp.diagnostic.show_line_diagnostics()', options) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', options) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', options) - buf_set_keymap('n', 'Q', 'lua vim.diagnostic.set_qflist()', options) - buf_set_keymap('n', 'F', 'lua vim.lsp.buf.formatting()', options) + map('n', 'gD', function() vim.lsp.buf.declaration() end, options) + map('n', 'gd', function() vim.lsp.buf.definition() end, options) + map('n', 'k', function() vim.lsp.buf.hover() end, options) + map('n', 's', function() vim.lsp.buf.signature_help() end, options) + map('n', 'r', function() vim.lsp.buf.rename() end, options) + map('n', 'a', function() vim.lsp.buf.code_action() end, options) + map('n', 'gr', function() vim.lsp.buf.references() end, options) + map('n', 'd', function() vim.diagnostic.open_float() end, options) + map('n', '[d', function() vim.diagnostic.goto_prev() end, options) + map('n', ']d', function() vim.diagnostic.goto_next() end, options) + map('n', 'Q', function() vim.diagnostic.set_qflist() end, options) + map('n', 'F', function() vim.lsp.buf.formatting() end, options) end