Add do#show_documentation() using coc.nvim
Change the `K` normal mode overrides to use the example given in the
coc.nvim README file which uses Vim's builtin help when in `vim` or
`help` files, or checks if coc.nvim is ready and invokes
`CocActionAsync('doHover')`, otherwise fallback to using `keywordprg`.
This commit is contained in:
@@ -100,3 +100,14 @@ endfunction
|
||||
" A sink for mappings to do nothing
|
||||
function! do#sink() abort
|
||||
endfunction
|
||||
|
||||
" Used by normal mode K mapping to show documentation
|
||||
function! do#show_documentation()
|
||||
if index(['vim','help'], &filetype) >= 0
|
||||
execute 'help '.expand('<cword>')
|
||||
elseif coc#rpc#ready() " TODO: Check if the LS supports doHover
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
execute '!'.&keywordprg.' '.expand('<cword>')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user