enabled snippets autocomplete via tab as well as VSCode like navigation via tab

This commit is contained in:
paul-loedige
2021-04-26 10:28:48 +02:00
parent 2e6ddfcfc9
commit d360e1fbfe
+12 -4
View File
@@ -117,8 +117,16 @@ function! s:check_back_space() abort
return !col || getline('.')[col - 1] =~ '\s' return !col || getline('.')[col - 1] =~ '\s'
endfunction endfunction
" Tab for autocomplete " Make <tab> used for trigger completion, completion confirm, snippet expand and jump like VSCode.
inoremap <silent><expr> <Tab> inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" : \ pumvisible() ? coc#_select_confirm() :
\ <SID>check_back_space() ? "\<Tab>" : \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh() \ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'