Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode-like auto completion in vim (without tab)?

Greetings. I've been using vim for years, and I've recently started toying with XCode. One of the things I really like about XCode is that it will auto complete words without me hitting <TAB>.

For instance, in this image below I only need to type NSSObj and the rest is filled in automatically, no special keystroke required.

alt text

I'd like to reproduce this effect in vim.

To be clear, this question is not about how to get tab/omni-completion working in vim. I've already got tab/omni completion working just fine and that's not a problem. The question is: does anyone know how to get vim to autocomplete as I am typing ?

like image 572
Nate Murray Avatar asked May 28 '09 15:05

Nate Murray


People also ask

Does vim have code completion?

Vim text editor supports autocompletion for the standard text files by default. Also, when configured properly, Vim enables an autocomplete feature for files with code in the languages it recognizes.

How do I get suggestions in Xcode?

Press the escape key when auto-complete makes the first suggestion. This will display the list. Escape or control-comma will show the list, control-period will accept the current suggestion and (subsequently) rotate through suggestions, control-slash will move to the next placeholder argument that was inserted.

How do I enable VIM in Xcode 13?

to enable Preferences → Text Editing → Editing → Enable Vim key bindings.


2 Answers

vimscripts has a plugin called autocomplpop.vim that does what you want.

like image 71
Bryan Alves Avatar answered Oct 03 '22 07:10

Bryan Alves


Another option is a vim script called neocomplcache made by Shougo.

like image 30
Hai Feng Kao Avatar answered Oct 03 '22 08:10

Hai Feng Kao