From f8309b1adc92afa688b9873e8487d5822e0950be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=B0=B8=E6=98=A5?= Date: Thu, 18 Dec 2025 14:17:26 +0800 Subject: [PATCH] coc.nvim support --- layers/plug/coc.vim | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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') }