-
-
Save 7c00/55722b69a99d8fc26325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set cot=menu,menuone | |
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR> | |
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "" | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
function! s:skinny_insert(char) | |
if !pumvisible() && !exists('s:skinny_complete') && | |
\ getline('.')[col('.') - 2].a:char =~# '\k\k' | |
let s:skinny_complete = 1 | |
noautocmd call feedkeys("\<C-n>\<C-p>", "nt") | |
endif | |
endfunction | |
augroup SkinnyAutoComplete | |
autocmd! | |
autocmd InsertCharPre * call <SID>skinny_insert(v:char) | |
autocmd CompleteDone * if exists('s:skinny_complete') | unlet s:skinny_complete | endif | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment