config: nvim: add basic language server protocol support
This commit is contained in:
parent
3b83281feb
commit
a4762ca7a2
3 changed files with 28 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
source $HOME/.config/nvim/plugins.vim
|
||||
source $HOME/.config/nvim/general.vim
|
||||
source $HOME/.config/nvim/keybindings.vim
|
||||
source $HOME/.config/nvim/lsp.vim
|
||||
|
|
|
|||
25
config/nvim/lsp.vim
Normal file
25
config/nvim/lsp.vim
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
" lsp-config
|
||||
if has('nvim')
|
||||
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> K <cmd>lua vim.lsp.buf.hover()<CR>
|
||||
nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
|
||||
nnoremap <silent> <C-r> <cmd>lua vim.lsp.buf.rename()<CR>
|
||||
nnoremap <silent> <C-n> <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||
nnoremap <silent> <C-p> <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
|
||||
|
||||
" auto-format
|
||||
autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||
autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 100)
|
||||
|
||||
" setup lsp-providers
|
||||
" (-> need to be installed manually first and then added here)
|
||||
lua require'lspconfig'.ccls.setup{}
|
||||
lua require'lspconfig'.clangd.setup{}
|
||||
lua require'lspconfig'.pyright.setup{}
|
||||
lua require'lspconfig'.bashls.setup{}
|
||||
lua require'lspconfig'.gopls.setup{}
|
||||
endif
|
||||
|
|
@ -11,6 +11,8 @@ Plug 'romainl/vim-dichromatic'
|
|||
|
||||
" only for nvim!
|
||||
if has('nvim')
|
||||
" language server protocol support
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
" colorizes colorcodes
|
||||
Plug 'norcalli/nvim-colorizer.lua'
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue