53 lines
1.7 KiB
VimL
53 lines
1.7 KiB
VimL
set hidden
|
|
set nobackup
|
|
set nowritebackup
|
|
|
|
set cmdheight=2
|
|
set shortmess+=c
|
|
set signcolumn=yes
|
|
|
|
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
|
|
|
function! s:show_documentation()
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
execute 'h '.expand('<cword>')
|
|
else
|
|
call CocAction('doHover')
|
|
endif
|
|
endfunction
|
|
|
|
command! -nargs=0 Format :call CocAction('format')
|
|
|
|
" Binds
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
|
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
|
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
|
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
|
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
|
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
|
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
|
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
|
nnoremap <silent> <space>. <Plug>(coc-codeaction-selected)
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
nmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
xmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
function! s:cocActionsOpenFromSelected(type) abort
|
|
execute 'CocCommand actions.open ' . a:type
|
|
endfunction
|
|
xmap <silent> <leader>a :<C-u>execute 'CocCommand actions.open ' . visualmode()<CR>
|
|
nmap <silent> <leader>a :<C-u>set operatorfunc=<SID>cocActionsOpenFromSelected<CR>g@
|
|
|
|
nmap <leader>ac <Plug>(coc-codeaction)
|
|
nmap <leader>qf <Plug>(coc-fix-current)
|