From 2fb5a8cc2a33e56c36b3baa3ebac7e65591ec692 Mon Sep 17 00:00:00 2001 From: Jidbo Date: Tue, 26 Nov 2019 23:29:59 +0100 Subject: [PATCH] add coc.nvim config --- nvim/init.vim | 79 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index 0b85578..df23392 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -7,9 +7,6 @@ Plug 'tpope/vim-commentary' " brackets management Plug 'machakann/vim-sandwich' -" snippets -Plug 'SirVer/ultisnips' - " WINDOW MANAGEMENT " tmux navigator @@ -257,35 +254,57 @@ let g:fzf_buffers_jump = 1 " vimtex setup let g:vimtex_compile_progname = 'nvr' -" UltiSnip setup -" Trigger configuration -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" - -" If you want :UltiSnipsEdit to split your window. -let g:UltiSnipsEditSplit="vertical" -let g:UltiSnipsSnippetDirectories=[$HOME."/.vim/snipps"] - " colors.lua setup lua require'colorizer'.setup() -" deoplete setup -let g:deoplete#enable_at_startup = 1 -let g:python3_host_prog = '/usr/bin/python' - -" vim-ale setup -let g:ale_completion_enabled = 1 -let g:ale_lint_on_text_changed = 'never' -let g:ale_fixers = { -\ '*': ['trim_whitespace'], -\ 'python': ['autopep8'] -\ } -nmap d :ALEGoToDefinition -nmap r :ALEFindReferences -nmap b :ALEFix -nnoremap l :lnext -nnoremap p :lprevious - " tmux setup let g:tmuxcomplete#trigger = '' + +" Coc vim setup +set hidden +set updatetime=300 +set shortmess+=c +" Use to trigger completion. +inoremap coc#refresh() +" navigate diagnostics +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) +" goto remaps +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) +" Use K to show documentation in preview window +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +" Remap for rename current word +nmap rn (coc-rename) + +" Use `:Form` to format current buffer +command! -nargs=0 Form :call CocAction('format') + +" Using CocList +" Show all diagnostics +nnoremap a :CocList diagnostics +" Manage extensions +nnoremap x :CocList extensions +" Show commands +nnoremap c :CocList commands +" Find symbol of current document +nnoremap o :CocList outline +" Search workspace symbls +nnoremap s :CocList -I symbols +" Do default action fo next item. +nnoremap j :CocNext +" Do default action for previous item. +nnoremap k :CocPrev +" Resume latest coc list +nnoremap p :CocListResume