12

Consider the scenerio when I have typed:

file.f

When I type Ctrl-XCtrl-O the omni-completion popup is shown and the first item is selected. This is what I see:

file.fileno
       ---------
       fileno()  <-- highlighted
       flush()
       ---------

Notice that the text that I have typed ("file.f") has already changed to:

file.fileno

I can move selection down in the list to 'flush', press ENTER and it will end up with

f.flush()

But I would like to continue typing the desired method name instead of using arrow keys. I.e. I would like to type "file.f", "Ctrl-X Ctrl-O", "l" and get either

file.fileno
       ---------
       flush()
       ---------

or

file.fileno
       ---------
       fileno()
       flush()  <-- highlighted
       ---------

Is this possible? Maybe some omni-completion settings have to be changed, or I should use a different keys combination instead of Ctrl-XCtrl-O?

dsummersl
  • 6,588
  • 50
  • 65
alex2k8
  • 42,496
  • 57
  • 170
  • 221

1 Answers1

16

Add: set completeopt+=longest to your .vimrc file.

This will tell omnicomplete to only insert the longest common text of all the matches.

For more information, run the command :help completeopt while in vim.

cledoux
  • 4,717
  • 1
  • 22
  • 30