summaryrefslogtreecommitdiff
path: root/lua/lsp/keybinds.lua
diff options
context:
space:
mode:
authorChris <[email protected]>2021-07-28 17:15:35 -0400
committerChris <[email protected]>2021-07-28 17:15:35 -0400
commit78dd92b6168d0e602979c3866e7d30ef219d1fc6 (patch)
treef3538de59cf5b2ec80f31bb08754c86d09b78f89 /lua/lsp/keybinds.lua
parent339aa8756e126821898b5e87a92014d7ce2e4aaf (diff)
more refactor
Diffstat (limited to 'lua/lsp/keybinds.lua')
-rw-r--r--lua/lsp/keybinds.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/lua/lsp/keybinds.lua b/lua/lsp/keybinds.lua
new file mode 100644
index 00000000..2ca930c7
--- /dev/null
+++ b/lua/lsp/keybinds.lua
@@ -0,0 +1,29 @@
+local M = {}
+
+function M.setup()
+ function M.setup_default_bindings()
+ if lvim.lsp.default_keybinds then
+ vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
+ vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
+ vim.cmd "nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>"
+ vim.cmd "nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>"
+ vim.api.nvim_set_keymap(
+ "n",
+ "gl",
+ '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = "single" })<CR>',
+ { noremap = true, silent = true }
+ )
+
+ vim.cmd "nnoremap <silent> gp <cmd>lua require'lsp.utils'.PeekDefinition()<CR>"
+ vim.cmd "nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>"
+ vim.cmd "nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
+ vim.cmd "nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
+ -- vim.cmd "nnoremap <silent> <tab> <cmd>lua vim.lsp.buf.signature_help()<CR>"
+ -- scroll down hover doc or scroll in definition preview
+ -- scroll up hover doc
+ -- vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
+ end
+ end
+end
+
+return M