cwonrails
1/7/2017 - 3:48 PM

tabcomplete

tabcomplete

inoremap <expr> <tab> pumvisible() ? '<c-n>' : '<tab>'
inoremap <expr> <s-tab> pumvisible() ? '<c-p>' : '<tab>'
augroup autocomplete
    autocmd!
    autocmd TextChangedI * call TypeComplete()
augroup end
fun! TypeComplete()
  if getline('.')[col('.') - 2] =~ '\K' && getline('.')[col('.') - 1] !~ '\K'
    call feedkeys("\<c-n>")
  end
endfun