|
@@ -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.
|