summaryrefslogtreecommitdiff
path: root/.config/nvim/plug-config/lsp-config.vim
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-14 21:58:45 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-03-14 21:58:45 +0100
commit8577c3b7cba714551d3537f3337ee2490bd20106 (patch)
treee881c2058f73ee5e67c68fcfac0df4b80c7de632 /.config/nvim/plug-config/lsp-config.vim
parent7f9c2629c4eb416fcda906d6ad25457b7cff1e22 (diff)
started moving to pure lua config
Diffstat (limited to '.config/nvim/plug-config/lsp-config.vim')
-rw-r--r--.config/nvim/plug-config/lsp-config.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/nvim/plug-config/lsp-config.vim b/.config/nvim/plug-config/lsp-config.vim
new file mode 100644
index 0000000..f9150a2
--- /dev/null
+++ b/.config/nvim/plug-config/lsp-config.vim
@@ -0,0 +1,19 @@
+" LSP config (the mappings used in the default file don't quite work right)
+nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
+nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>
+nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
+nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>
+nnoremap <silent> ca :Lspsaga code_action<CR>
+" nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
+nnoremap <silent> K :Lspsaga hover_doc<CR>
+nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
+" nnoremap <silent> <C-p> <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
+" nnoremap <silent> <C-n> <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
+nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>
+nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>
+
+" autoformat
+autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100)
+" autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 100)