47 lines
1.3 KiB
VimL
47 lines
1.3 KiB
VimL
let g:coc_global_extensions = ['coc-highlight', 'coc-snippets', 'coc-tsserver', 'coc-css', 'coc-html', 'coc-json', 'coc-emmet']
|
|
|
|
" Config
|
|
nnoremap <silent><F6> :vsplit<CR><Bar>:CocConfig<CR>
|
|
|
|
let g:coc_snippet_next = '<TAB>'
|
|
let g:coc_snippet_prev = '<S-TAB>'
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
\ pumvisible() ? "\<C-n>" :
|
|
\ coc#expandableOrJumpable() ?
|
|
\ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
\ coc#refresh()
|
|
|
|
function! s:check_back_space() abort
|
|
let col = col('.') - 1
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
endfunction
|
|
|
|
inoremap <silent><expr> <C-space> coc#refresh()
|
|
|
|
if exists('*complete_info')
|
|
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
else
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
endif
|
|
|
|
" GoTo code navigation.
|
|
nnoremap <silent> gd <Plug>(coc-definition)
|
|
nnoremap <silent> gr <Plug>(coc-references)
|
|
|
|
" Use D to show documentation in preview window.
|
|
nnoremap <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 <leader>rn <Plug>(coc-rename)
|
|
|