From a83dea3c8c92a30c83760c0e71bb35322190105b Mon Sep 17 00:00:00 2001 From: gxlin Date: Tue, 20 Jul 2021 23:30:18 +0800 Subject: Config of vim lsp --- .emacs.d/init.el | 1 - .emacs.d/lisp/init-org.el | 1 + .vim/plugin/general.plug | 4 ++++ .vim/plugin/lsp.plug | 39 --------------------------------------- .vim/plugin/lsp.vim | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 40 deletions(-) delete mode 100644 .vim/plugin/lsp.plug create mode 100644 .vim/plugin/lsp.vim diff --git a/.emacs.d/init.el b/.emacs.d/init.el index e070fc2..5d07f24 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -15,7 +15,6 @@ (require 'init-package) (require 'init-evil) (require 'init-org) -(require 'init-mu4e) (require 'init-lang) (require 'init-misc) diff --git a/.emacs.d/lisp/init-org.el b/.emacs.d/lisp/init-org.el index 50061b2..8e4d784 100644 --- a/.emacs.d/lisp/init-org.el +++ b/.emacs.d/lisp/init-org.el @@ -33,6 +33,7 @@ (kbd "oih") 'org-insert-heading (kbd "oci") 'org-clock-in (kbd "oco") 'org-clock-out + (kbd "ocr") 'org-clock-report (kbd "sp") 'org-set-property (kbd "+") 'org-priority-up (kbd "-") 'org-priority-down) diff --git a/.vim/plugin/general.plug b/.vim/plugin/general.plug index 453acba..d68ee70 100644 --- a/.vim/plugin/general.plug +++ b/.vim/plugin/general.plug @@ -1,9 +1,13 @@ +" vim: ft=vim + Plug 'Yggdroot/LeaderF', {'do': ':LeaderfInstallCExtension'} Plug 'Valloric/YouCompleteMe', { \ 'do': 'python3 ./install.py --clangd-completer', \ } Plug 'dense-analysis/ale' Plug 'sheerun/vim-polyglot' +Plug 'prabirshrestha/vim-lsp' +Plug 'mattn/vim-lsp-settings' let g:ycm_language_server = [] let g:Lf_RootMarkers = [] diff --git a/.vim/plugin/lsp.plug b/.vim/plugin/lsp.plug deleted file mode 100644 index 1a5704b..0000000 --- a/.vim/plugin/lsp.plug +++ /dev/null @@ -1,39 +0,0 @@ -Plug 'prabirshrestha/vim-lsp' - -if executable('gopls') - au User lsp_setup call lsp#register_server({ - \ 'name': 'gopls', - \ 'cmd': {server_info->['gopls']}, - \ 'allowlist': ['go'], - \ }) -endif - -function! s:on_lsp_buffer_enabled() abort - setlocal omnifunc=lsp#complete - setlocal signcolumn=no - if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif - nmap gd (lsp-definition) - nmap gs (lsp-document-symbol-search) - nmap gS (lsp-workspace-symbol-search) - nmap gr (lsp-references) - nmap gi (lsp-implementation) - nmap gt (lsp-type-definition) - nmap rn (lsp-rename) - nmap [g (lsp-previous-diagnostic) - nmap ]g (lsp-next-diagnostic) - nmap K (lsp-hover) - inoremap lsp#scroll(+4) - inoremap 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 - diff --git a/.vim/plugin/lsp.vim b/.vim/plugin/lsp.vim new file mode 100644 index 0000000..2816300 --- /dev/null +++ b/.vim/plugin/lsp.vim @@ -0,0 +1,38 @@ +if executable('gopls') + au User lsp_setup call lsp#register_server({ + \ 'name': 'gopls', + \ 'cmd': {server_info->['gopls']}, + \ 'allowlist': ['go'], + \ }) +endif + +function! s:on_lsp_buffer_enabled() abort + setlocal omnifunc=lsp#complete + setlocal signcolumn=no + if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif + nmap gd (lsp-definition) + nmap gs (lsp-document-symbol-search) + nmap gS (lsp-workspace-symbol-search) + nmap gr (lsp-references) + nmap gi (lsp-implementation) + nmap gt (lsp-type-definition) + nmap rn (lsp-rename) + nmap [g (lsp-previous-diagnostic) + nmap ]g (lsp-next-diagnostic) + nmap K (lsp-hover) + inoremap lsp#scroll(+4) + inoremap 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 + +let g:lsp_settings_filetype_lua = 'sumneko-lua-language-server' -- cgit v1.2.3