Working with LSP
authorSergey Matveev <stargrave@stargrave.org>
Fri, 10 Jul 2020 15:43:27 +0000 (18:43 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 10 Jul 2020 15:43:27 +0000 (18:43 +0300)
vim/.vim/plugin/lsp.vim [new file with mode: 0644]

diff --git a/vim/.vim/plugin/lsp.vim b/vim/.vim/plugin/lsp.vim
new file mode 100644 (file)
index 0000000..1348fc4
--- /dev/null
@@ -0,0 +1,22 @@
+let g:lsp_settings = {
+\  'clangd': {'cmd': ['clangd60']},
+\}
+
+let g:asyncomplete_auto_completeopt = 0
+let g:lsp_settings_enable_suggestions = 0
+let g:lsp_highlight_references_enabled = 1
+let g:lsp_diagnostics_echo_cursor = 1
+
+function! s:on_lsp_buffer_enabled() abort
+    setlocal completeopt=menuone,noinsert,noselect
+    setlocal omnifunc=lsp#complete
+    nmap <buffer> [g <Plug>(lsp-previous-diagnostic)
+    nmap <buffer> ]g <Plug>(lsp-next-diagnostic)
+    nmap <buffer> gd <plug>(lsp-definition)
+    nmap <buffer> K <plug>(lsp-hover)
+endfunction
+
+augroup lsp_install
+    autocmd!
+    autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
+augroup END