From 88b23fa9db0180871249e1b46db6565c638a40a6 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 26 Oct 2020 08:08:44 +0100 Subject: [PATCH] Switched from deoplete/language-client-neovim to coc.nvim --- nvim/coc-settings.json | 3 +++ nvim/init.vim | 58 ++++++++++++++++-------------------------- nvim/install.sh | 1 + 3 files changed, 26 insertions(+), 36 deletions(-) create mode 100644 nvim/coc-settings.json diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json new file mode 100644 index 0000000..cfb747a --- /dev/null +++ b/nvim/coc-settings.json @@ -0,0 +1,3 @@ +{ + "coc.preferences.formatOnSaveFiletypes": ["cpp", "markdown", "python", "rust"] +} diff --git a/nvim/init.vim b/nvim/init.vim index c5efd5b..8e2f5a7 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -20,13 +20,6 @@ Plug 'christoomey/vim-tmux-navigator' Plug 'mandlm/vim-split-open' -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } - Plug 'tpope/vim-dispatch' Plug 'RRethy/vim-illuminate' @@ -44,6 +37,8 @@ Plug 'cespare/vim-toml' Plug 'vimwiki/vimwiki' +Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'git@gitlab.softwareparadies.de:IDE/swp-vim.git' call plug#end() @@ -125,37 +120,13 @@ let g:fzf_action = { \ 'ctrl-y': 'vsplit', \ } -" deoplete -let g:deoplete#enable_at_startup = 1 -silent! call deoplete#custom#source('_', 'matchers', ['matcher_full_fuzzy']) -silent! call deoplete#custom#option({ - \ 'smart_case': v:true, - \ 'ignore_sources': {'_': ['around', 'buffer']}, - \ }) - augroup close_preview autocmd InsertLeave * silent! pclose! augroup end -set completefunc=LanguageClient#complete - inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" -" LanguageClient-neovim -set hidden -nmap (lcn-menu) -nmap K (lcn-hover) -nmap gd (lcn-definition) - -let g:LanguageClient_serverCommands = { - \ 'python': ['pyls'], - \ 'cpp': ['clangd'], - \ 'rust': ['rustup', 'run', 'stable', 'rls'], - \ } - -let g:LanguageClient_selectionUI = 'fzf' - " autoread/checktime timer {{{ set autoread function! CheckTime(timer) @@ -174,14 +145,29 @@ augroup color_column autocmd Filetype cpp,python set colorcolumn=101 augroup end -" format on save -augroup auto_format - autocmd BufWritePre *.py,*.rs :call LanguageClient#textDocument_formatting_sync() -augroup end - " vimwiki let g:vimwiki_list = [ \ {'name': 'personal', 'path': '~/vimwiki/personal'}, \ {'name': 'swp', 'path': '~/vimwiki/swp'} \ ] +" coc +set updatetime=300 + +let g:coc_global_extensions = [ + \ 'coc-clangd', + \ 'coc-cmake', + \ 'coc-json', + \ 'coc-python', + \ 'coc-rust-analyzer', + \ 'coc-sh', + \ 'coc-vimlsp', + \ 'coc-yaml', + \ ] + +nnoremap K :call CocAction('doHover') + +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) diff --git a/nvim/install.sh b/nvim/install.sh index d11b392..a6050d4 100755 --- a/nvim/install.sh +++ b/nvim/install.sh @@ -2,4 +2,5 @@ mkdir --parents ~/.config/nvim ln -svrf init.vim ~/.config/nvim/init.vim +ln -svrf coc-settings.json ~/.config/nvim/coc-settings.json