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.
|
||||||
|
if executable('node') " Coc only works if nodejs is available.
|
||||||
|
inoremap <silent><expr> <TAB>
|
||||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||||
\ CheckBackspace() ? "\<Tab>" :
|
\ CheckBackspace() ? "\<Tab>" :
|
||||||
\ coc#refresh()
|
\ coc#refresh()
|
||||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
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