Skip to content

Instantly share code, notes, and snippets.

@tommcdo
Forked from qstrahl/minimal-autocomplete.vim
Created December 5, 2013 18:19
Show Gist options
  • Save tommcdo/7810505 to your computer and use it in GitHub Desktop.
Save tommcdo/7810505 to your computer and use it in GitHub Desktop.
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-4:col('.')-2]=~#'\k\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
ino <CR> <C-r>=pumvisible()?"\<lt>C-y>":""<CR><CR>
ino <Tab> <C-r>=pumvisible()?"\<lt>C-n>":"\<lt>Tab>"<CR>
ino <S-Tab> <C-r>=pumvisible()?"\<lt>C-p>":"\<lt>S-Tab>"<CR>
augroup MyAutoComplete
au!
au InsertCharPre * if
\ !pumvisible() &&
\ !exists('s:complete') &&
\ getline('.')[col('.')-3:col('.')-2].v:char =~# '\k\k\k' |
\ let s:complete = 1 |
\ noautocmd call feedkeys("\<C-n>\<C-p>", "nt") |
\ endif
au CompleteDone * if exists('s:complete') | unlet s:complete | endif
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment