Skip to content

Instantly share code, notes, and snippets.

@lwakefield
Last active January 23, 2018 21:12
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lwakefield/4ae2d94e2c54f6ae9139fd2b4037163c to your computer and use it in GitHub Desktop.
Save lwakefield/4ae2d94e2c54f6ae9139fd2b4037163c 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