Skip to content

Instantly share code, notes, and snippets.

@markwu
Forked from lwakefield/tabcomplete.vim
Created January 7, 2017 16:26
Show Gist options
  • Select an option

  • Save markwu/f7fda69de5c7caf1e34515804740be76 to your computer and use it in GitHub Desktop.

Select an option

Save markwu/f7fda69de5c7caf1e34515804740be76 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment