Alexander Duchene
Alexander Duchene

Reputation: 1137

Bash-like code completion in vim?

I'm currently using superTab for completions in Vim. However, I'd like the completions to be more like bash. For example, if I'm typing

st

and the possible completions are

struct, string

I'd like it to be completed to

str 

if I press tab, and ideally display a menu of possible completions.

Plugins are OK.

EDIT: completeopt+=menu, longest does most of what I want, but after the menu pops up and I narrow it down some, pressing tab again does a full completion instead of giving the next longest common prefix.

Upvotes: 4

Views: 1697

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172510

:set completeopt+=longest

should do the trick.

A great resource for tweaking the completion is Make Vim completion popup menu work just like in an IDE.

Upvotes: 3

Related Questions