Disable coc bindings when coc not loaded.
This commit is contained in:
parent
3ab0a641a4
commit
69518afa81
1 changed files with 18 additions and 15 deletions
|
@ -59,21 +59,24 @@ let g:vimspector_install_gadgets = ['debugpy']
|
||||||
|
|
||||||
" Config for Coc originally from their github.
|
" Config for Coc originally from their github.
|
||||||
" Use tab for trigger completion with characters ahead and navigate
|
" Use tab for trigger completion with characters ahead and navigate
|
||||||
inoremap <silent><expr> <TAB>
|
" If node is not available Coc will not be loaded so disable.
|
||||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
if executable('node') " Coc only works if nodejs is available.
|
||||||
\ CheckBackspace() ? "\<Tab>" :
|
inoremap <silent><expr> <TAB>
|
||||||
\ coc#refresh()
|
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
\ CheckBackspace() ? "\<Tab>" :
|
||||||
|
\ coc#refresh()
|
||||||
|
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||||
|
|
||||||
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||||
|
|
||||||
" Use <c-space> to trigger completion
|
" Use <c-space> to trigger completion
|
||||||
inoremap <silent><expr> <c-@> coc#refresh()
|
inoremap <silent><expr> <c-@> coc#refresh()
|
||||||
|
|
||||||
" Dependenciy of the above. fom Coc github.
|
" Dependenciy of the above. fom Coc github.
|
||||||
function! CheckBackspace() abort
|
function! CheckBackspace() abort
|
||||||
let col = col('.') - 1
|
let col = col('.') - 1
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
return !col || getline('.')[col - 1] =~# '\s'
|
||||||
endfunction
|
endfunction
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue