-
-
Save applicato/30b44ad6c183db711b91bd1b01b8a6bb 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
| " Add this to your vimrc to get a minimalist autocomplete pop | |
| " Or use as a plugin : https://github.com/maxboisvert/vim-simple-complete | |
| " Minimalist-TabComplete-Plugin | |
| inoremap <expr> <Tab> TabComplete() | |
| fun! TabComplete() | |
| if getline('.')[col('.') - 2] =~ '\K' || pumvisible() | |
| return "\<C-P>" | |
| else | |
| return "\<Tab>" | |
| endif | |
| endfun | |
| " Minimalist-AutoCompletePop-Plugin | |
| set completeopt=menu,menuone,noinsert | |
| inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>" | |
| autocmd InsertCharPre * call AutoComplete() | |
| fun! AutoComplete() | |
| if v:char =~ '\K' | |
| \ && getline('.')[col('.') - 4] !~ '\K' | |
| \ && getline('.')[col('.') - 3] =~ '\K' | |
| \ && getline('.')[col('.') - 2] =~ '\K' " last char | |
| \ && getline('.')[col('.') - 1] !~ '\K' | |
| call feedkeys("\<C-P>", 'n') | |
| end | |
| endfun | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment