commit 8dc62532f310bd42540f2c5cd224f2af82d6d991
parent 10353af50adacb395ce7d30a59ee49f3712db199
Author: Pablo Cárdenas <pablo.cardenas@imca.edu.pe>
Date: Fri, 23 Dec 2022 19:06:59 -0500
Added vim-lsp
Diffstat:
3 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -16,3 +16,6 @@
[submodule "pack/pablo/start/vim-surround"]
path = pack/pablo/start/vim-surround
url = https://github.com/tpope/vim-surround.git
+[submodule "pack/pablo/start/vim-lsp"]
+ path = pack/pablo/start/vim-lsp
+ url = https://github.com/prabirshrestha/vim-lsp
diff --git a/pack/pablo/start/vim-lsp b/pack/pablo/start/vim-lsp
@@ -0,0 +1 @@
+Subproject commit 2cb7ef587cd2c79dd98a7cd3ff301cc415296629
diff --git a/plugin/pablo/vim-lsp.vim b/plugin/pablo/vim-lsp.vim
@@ -0,0 +1,38 @@
+if executable('pylsp')
+ " pip install python-lsp-server
+ au User lsp_setup call lsp#register_server({
+ \ 'name': 'pylsp',
+ \ 'cmd': {server_info->['pylsp']},
+ \ 'allowlist': ['python'],
+ \ })
+endif
+
+
+function! s:on_lsp_buffer_enabled() abort
+ setlocal omnifunc=lsp#complete
+ setlocal signcolumn=yes
+ if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
+ nmap <buffer> gd <plug>(lsp-definition)
+ nmap <buffer> gs <plug>(lsp-document-symbol-search)
+ nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
+ nmap <buffer> gr <plug>(lsp-references)
+ nmap <buffer> gi <plug>(lsp-implementation)
+ nmap <buffer> gt <plug>(lsp-type-definition)
+ nmap <buffer> <leader>rn <plug>(lsp-rename)
+ nmap <buffer> [g <plug>(lsp-previous-diagnostic)
+ nmap <buffer> ]g <plug>(lsp-next-diagnostic)
+ nmap <buffer> K <plug>(lsp-hover)
+ nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
+ nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
+
+ let g:lsp_format_sync_timeout = 1000
+ autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
+
+ " refer to doc to add more commands
+endfunction
+
+augroup lsp_install
+ au!
+ " call s:on_lsp_buffer_enabled only for languages that has the server registered.
+ autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
+augroup END