From f5d56602df70950de6b7d40966b00c9939c81763 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 26 Jan 2020 17:16:07 +0100 Subject: Intial commit of v2 See https://drewdevault.com/2019/12/30/dotfiles.html --- .vim/after/plugin/coc.vim | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .vim/after/plugin/coc.vim (limited to '.vim/after/plugin/coc.vim') diff --git a/.vim/after/plugin/coc.vim b/.vim/after/plugin/coc.vim new file mode 100644 index 0000000..2ebe27a --- /dev/null +++ b/.vim/after/plugin/coc.vim @@ -0,0 +1,84 @@ +" coc json config -> ../../coc-settings.json +if !exists('g:did_coc_loaded') + finish +endif + +set completeopt=noinsert,menuone,noselect +set completeopt-=preview +set shortmess+=c +" set showmatch + +" let g:coc_auto_copen = 1 +let g:coc_snippet_next = '' +let g:coc_snippet_prev = '' + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" inoremap +" \ pumvisible() ? "\" : +" \ check_back_space() ? "\" : +" \ coc#refresh() +inoremap + \ pumvisible() ? coc#_select_confirm() : + \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ check_back_space() ? "\" : + \ coc#refresh() + +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\u\" +inoremap coc#refresh() + +vmap (coc-snippets-select) + +nmap [c (coc-diagnostic-next) +nmap ]c (coc-diagnostic-prev) +nmap lc :CocList diagnostics + +imap (coc-complete-custom) +nmap d (coc-definition) +nmap t (coc-type-definition) +nmap i (coc-implementation) +nmap r (coc-references) +nmap rn (coc-rename) +nmap qf (coc-fix-current) +nmap ac (coc-codeaction) + +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +xmap a (coc-codeaction-current) +nmap a (coc-codeaction-current) +nmap ac (coc-codeaction) + +nmap o :CocList outline + +function! s:show_doc() + if (index(['vim', 'help'], &filetype) >= 0) + execute 'h ' . expand('') + else + call CocAction('doHover') + endif +endfunction +nmap i :silent! call show_doc() + +au CursorHold * silent call CocActionAsync('highlight') + +command! -nargs=0 Format :call CocAction('format') +command! -nargs=? Fold :call CocAction('fold', ) + +let g:lightline.component_function.coc = 'LightLineCocStatus' +function! LightLineCocStatus() + let info = get(b:, 'coc_diagnostic_info', {}) + if empty(info) | return '' | endif + let msgs = [] + if get(info, 'error', 0) + call add(msgs, '✘ ' . info['error']) + endif + if get(info, 'warning', 0) + call add(msgs, '‼ ' . info['warning']) + endif + return 'coc: ' . join(msgs, ' ') +endfunction -- cgit 1.4.1