20 lines
701 B
VimL
20 lines
701 B
VimL
function! s:check_back_space() abort
|
|
let col = col('.') - 1
|
|
return !col || getline('.')[col - 1] =~ '\s'
|
|
endfunction
|
|
|
|
inoremap <silent><expr> <Tab>
|
|
\ pumvisible() ? "\<C-n>" :
|
|
\ <SID>check_back_space() ? "\<Tab>" :
|
|
\ coc#refresh()
|
|
|
|
" Navigating through results list
|
|
" Tab to select next result
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
" Shift+Tab to select previous
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
" Use enter to confirm completion
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
" Select first option if no option is selected on enter
|
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
|