Select _and_ trigger completion with <tab>
This commit is contained in:
parent
e34a27110e
commit
437e2fedf9
@ -125,9 +125,6 @@ augroup close_preview
|
||||
autocmd InsertLeave * silent! pclose!
|
||||
augroup end
|
||||
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
|
||||
" autoread/checktime timer {{{
|
||||
set autoread
|
||||
function! CheckTime(timer)
|
||||
@ -174,3 +171,20 @@ nnoremap <silent> K :call CocAction('doHover')<CR>
|
||||
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" use <tab> for trigger completion and navigate to the next complete item
|
||||
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()
|
||||
|
||||
inoremap <silent><expr> <S-Tab>
|
||||
\ pumvisible() ? "\<C-p>" :
|
||||
\ <SID>check_back_space() ? "\<S-Tab>" :
|
||||
\ coc#refresh()
|
||||
|
||||
|
Reference in New Issue
Block a user