diff --git a/layers/plug/coc.vim b/layers/plug/coc.vim index 9e1fe42..e8995d2 100644 --- a/layers/plug/coc.vim +++ b/layers/plug/coc.vim @@ -1,19 +1,11 @@ vim9script -def CheckBackspace(): bool +export def CheckBackspace(): bool let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' enddef -def ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -enddef - -final g:coc_global_extensions = ['coc-marketplace', 'coc-json', 'coc-vimlsp', 'coc-explorer', 'coc-git'] +g:coc_global_extensions = ['coc-marketplace', 'coc-json', 'coc-vimlsp', 'coc-explorer', 'coc-git'] tui#core#plug#Regist('neoclide/coc.nvim', { branch: 'release', @@ -27,7 +19,7 @@ tui#core#plug#Regist('neoclide/coc.nvim', { # Use to trigger completion inoremap coc#refresh() # Use K to show documentation in preview window - nnoremap K :call ShowDocumentation() + nnoremap K coc#rpc#request('hasProvider', ['hover']) ? coc#rpc#notify('doHover', []) : feedkeys('K', 'in') # Highlight the symbol and its references when holding the cursor autocmd CursorHold * silent call CocActionAsync('highlight') }