Select _and_ trigger completion with <tab>
This commit is contained in:
parent
e34a27110e
commit
437e2fedf9
1 changed files with 17 additions and 3 deletions
|
@ -125,9 +125,6 @@ augroup close_preview
|
||||||
autocmd InsertLeave * silent! pclose!
|
autocmd InsertLeave * silent! pclose!
|
||||||
augroup end
|
augroup end
|
||||||
|
|
||||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
||||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
||||||
|
|
||||||
" autoread/checktime timer {{{
|
" autoread/checktime timer {{{
|
||||||
set autoread
|
set autoread
|
||||||
function! CheckTime(timer)
|
function! CheckTime(timer)
|
||||||
|
@ -174,3 +171,20 @@ nnoremap <silent> K :call CocAction('doHover')<CR>
|
||||||
|
|
||||||
nmap <silent> gd <Plug>(coc-definition)
|
nmap <silent> gd <Plug>(coc-definition)
|
||||||
nmap <silent> gr <Plug>(coc-references)
|
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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue