diff options
| author | mo khan <mo.khan@gmail.com> | 2020-10-17 22:32:35 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-10-17 22:32:35 -0600 |
| commit | eb9fe0d52c6951835fa1d7367c1996fc960831c8 (patch) | |
| tree | 9e5675c8ea124b03ea24ecbd9e8584f82a2aac48 /plugin | |
| parent | a0475b86dcd55d7b38ef402b7b81e508479facb4 (diff) | |
Add coc config
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/coc-setup.vim | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/plugin/coc-setup.vim b/plugin/coc-setup.vim new file mode 100644 index 0000000..b4f08e8 --- /dev/null +++ b/plugin/coc-setup.vim @@ -0,0 +1,54 @@ +if has('nvim') + inoremap <silent><expr> <c-space> coc#refresh() +else + inoremap <silent><expr> <c-@> coc#refresh() +endif + +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) +nnoremap <silent> K :call <SID>show_documentation()<CR> + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('<cword>') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('<cword>') + endif +endfunction + +nmap <leader>rn <Plug>(coc-rename) +xmap <leader>f <Plug>(coc-format-selected) +nmap <leader>f <Plug>(coc-format-selected) +"xmap <leader>a <Plug>(coc-codeaction-selected) +"nmap <leader>a <Plug>(coc-codeaction-selected) +"nmap <leader>ac <Plug>(coc-codeaction) +"nmap <leader>qf <Plug>(coc-fix-current) +"xmap if <Plug>(coc-funcobj-i) +"omap if <Plug>(coc-funcobj-i) +"xmap af <Plug>(coc-funcobj-a) +"omap af <Plug>(coc-funcobj-a) +"xmap ic <Plug>(coc-classobj-i) +"omap ic <Plug>(coc-classobj-i) +"xmap ac <Plug>(coc-classobj-a) +"omap ac <Plug>(coc-classobj-a) +"nnoremap <expr><C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" +"nnoremap <expr><C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" +"inoremap <expr><C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<Right>" +"inoremap <expr><C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<Left>" +"nmap <silent> <C-s> <Plug>(coc-range-select) +"xmap <silent> <C-s> <Plug>(coc-range-select) +"command! -nargs=0 Format :call CocAction('format') +"command! -nargs=? Fold :call CocAction('fold', <f-args>) +"command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') +"nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> +"nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> +"nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> +"nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> +"nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> +"nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> +"nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> +"nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> |
