46 lines
1.4 KiB
VimL
46 lines
1.4 KiB
VimL
set completeopt-=preview
|
|
|
|
nnoremap <silent><F6> :vsplit<CR><Bar>:CocConfig<CR>
|
|
|
|
let g:coc_global_extensions = ['coc-highlight', 'coc-snippets', 'coc-tsserver', 'coc-css', 'coc-html', 'coc-json']
|
|
|
|
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
|
" position. Coc only does snippet and additional edit on confirm.
|
|
if exists('*complete_info')
|
|
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
else
|
|
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
endif
|
|
|
|
" use <c-@>for trigger completion
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
|
|
|
" Navigate diagnostics
|
|
nnoremap <silent> <F7> :<C-u>CocList diagnostics<CR>
|
|
nmap <silent> <F8> <Plug>(coc-diagnostic-prev)
|
|
nmap <silent> <F9> <Plug>(coc-diagnostic-next)
|
|
|
|
" GoTo code navigation.
|
|
nnoremap <buffer><silent> gd <Plug>(coc-definition)
|
|
nnoremap <buffer><silent> gr <Plug>(coc-references)
|
|
|
|
" Use D to show documentation in preview window.
|
|
nnoremap <buffer><silent> D :call <SID>show_documentation()<CR>
|
|
|
|
function! s:show_documentation()
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
execute 'h '.expand('<cword>')
|
|
else
|
|
call CocAction('doHover')
|
|
endif
|
|
endfunction
|
|
|
|
" Symbol renaming.
|
|
nnoremap <buffer><leader>rn <Plug>(coc-rename)
|
|
|
|
aug Cursor
|
|
au!
|
|
" au CursorHold * silent call CocActionAsync('highlight')
|
|
au User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
|
aug END
|