coc.nvim support

This commit is contained in:
2025-12-18 14:17:26 +08:00
parent f5fa3685d2
commit f8309b1adc

View File

@ -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 <c-space> to trigger completion
inoremap <silent><expr> <c-@> coc#refresh()
# Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
nnoremap <silent><expr> 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')
}