summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNao Ueda <nao.uedder@gmail.com>2020-04-09 07:32:15 +0900
committerNao Ueda <nao.uedder@gmail.com>2020-04-09 07:32:15 +0900
commit758f0abd0094dad4c6d41de955efbee340348f39 (patch)
tree0385e91997cf2677c14c201c1536b7cf69dc6d18
parentb07497f848f80aebd4a8400bb8d22751022678d3 (diff)
downloadvimrc-758f0abd0094dad4c6d41de955efbee340348f39.tar.gz
vimrc-758f0abd0094dad4c6d41de955efbee340348f39.tar.bz2
vimrc-758f0abd0094dad4c6d41de955efbee340348f39.zip
Add/Modify config for LSP.
-rw-r--r--_config/200-lsp.vim21
1 files changed, 16 insertions, 5 deletions
diff --git a/_config/200-lsp.vim b/_config/200-lsp.vim
index 4cfcbb2..a88fa20 100644
--- a/_config/200-lsp.vim
+++ b/_config/200-lsp.vim
@@ -23,9 +23,20 @@ let g:lsp_settings = {
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
-nmap gd <plug>(lsp-definition)
-nmap gD <plug>(lsp-references)
-nmap K <plug>(lsp-hover)
-nmap ]s <plug>(lsp-next-error)
-nmap [s <plug>(lsp-previous-error)
+function! s:on_lsp_buffer_enabled() abort
+ setlocal omnifunc=lsp#complete
+ setlocal signcolumn=yes
+ nmap <buffer> gd <plug>(lsp-definition)
+ nmap <buffer> <f2> <plug>(lsp-rename)
+ nmap <buffer> gD <plug>(lsp-references)
+ nmap <buffer> K <plug>(lsp-hover)
+ nmap <buffer> ]s <plug>(lsp-next-error)
+ nmap <buffer> [s <plug>(lsp-previous-error)
+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