28 lines
1.1 KiB
VimL
28 lines
1.1 KiB
VimL
vim9script
|
|
|
|
export def CheckBackspace(): bool
|
|
let col = col('.') - 1
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
enddef
|
|
|
|
g:coc_global_extensions = ['coc-marketplace', 'coc-json', 'coc-vimlsp', 'coc-explorer', 'coc-git']
|
|
|
|
tui#core#plug#Regist('neoclide/coc.nvim', {
|
|
branch: 'release',
|
|
config: () => {
|
|
set updatetime=300
|
|
set signcolumn=yes
|
|
|
|
inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#next(1) : CheckBackspace() ? "\<Tab>" : coc#refresh()
|
|
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
# Use <c-space> to trigger completion
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
|
# Use K to show documentation in preview window
|
|
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')
|
|
}
|
|
})
|
|
|