diff options
-rw-r--r-- | plug-config/coc/coc.vim | 26 | ||||
-rw-r--r-- | vim-plug/plugins.vim | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/plug-config/coc/coc.vim b/plug-config/coc/coc.vim index 597d39d9..0b0631ca 100644 --- a/plug-config/coc/coc.vim +++ b/plug-config/coc/coc.vim @@ -33,11 +33,19 @@ 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 - call CocAction('doHover') + execute '!' . &keywordprg . " " . expand('<cword>') endif endfunction +" set keywordprg=:call\ CocActionAsync('doHover') +" augroup VimHelp +" autocmd! +" autocmd Filetype vim,help setlocal keywordprg=:help +" augroup END + " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') @@ -69,6 +77,20 @@ xmap af <Plug>(coc-funcobj-a) omap if <Plug>(coc-funcobj-i) omap af <Plug>(coc-funcobj-a) +" Remap <C-f> and <C-b> for scroll float windows/popups. +" Note coc#float#scroll works on neovim >= 0.4.3 or vim >= 8.2.0750 +nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" +nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" +inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" +inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" + +" NeoVim-only mapping for visual mode scroll +" Useful on signatureHelp after jump placeholder of snippet expansion +if has('nvim') + vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>" + vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>" +endif + " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') @@ -81,7 +103,7 @@ command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organize " Add (Neo)Vim's native statusline support. " NOTE: Please see `:h coc-status` for integrations with external plugins that " provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} +" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Mappings using CoCList: " Show all diagnostics. diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index e541adde..7774b7a3 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -111,6 +111,8 @@ call plug#begin('~/.config/nvim/autoload/plugged') " Debugging Plug 'puremourning/vimspector' Plug 'szw/vim-maximizer' + " Neovim in Browser + Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } " Rainbow brackets " Plug 'luochen1990/rainbow' " Async Linting Engine |