Coc magic

This commit is contained in:
Dan Buch 2023-03-01 09:26:47 -05:00
parent 79cbb1d10b
commit d32ebf77a6
Signed by: meatballhat
GPG Key ID: A12F782281063434

14
vimrc
View File

@ -120,3 +120,17 @@ function! <SID>SynStack()
endif endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc endfunc
" use <tab> to trigger completion and navigate to the next complete item
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"