views:

730

answers:

4

Omnicompletion is working, but it automatically inserts the first result.

What I'd like to do is open the omnicomplete menu, then be able to type to narrow down the results, then hit enter or tab or space or something to insert the selected menu item.

Is this possible?

A: 

This plugin might do what you are after: autocomplpop

Or you can try and make Vim completion popup menu work just like in an IDE.

VonC
A: 

This is the general Vim completion behaviour. For a complete overview, you can do

:he compl-current

But for your specific case (which you require the completion to be in state 2 or 3 (described in the document above). You can simply use Backspace, or Control-H to jump from state one to state two. In state 2 you can narrow the search by typing regular characters. So to complete completion with narrowing:

compl<C-X><C-P><BS>letion

It is totally backwards, I know, but that's how it works.

Edit: You can use the Down arrow key too isntead of Control-H or Backspace, and it has the benefit of not deleting a character.

Ali A
+7  A: 

The command you are looking for is:

:set completeopt+=longest

It will insert the longest common prefix of all the suggestions, then you can type and delete to narrow down or expand results.

orestis
+1  A: 
set wildmenu
set wildmode=list:longest,full

Found here. There is also a great plugin for all of your completion needs called SuperTab continued.

Alexey Romanov