" 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