Search code examples
vimautocompleteyoucompleteme

How do I set vim's autocomplete popup menu location?


In vim, when using an autocomplete plugin (or just vim's built-in omnifunc), a window will pop up next to the cursor with completion suggestions:

autocompletion example

Vim tries to be smart about where to put this menu, putting it below the cursor most of the time, but above the cursor if you're near the bottom of the window and don't have space to see the window.

I recently updated to a new version of vim (and YouCompleteMe, the autocomplete plugin that I use), and it seems that vim (or YCM, not sure which is responsible) is now overly aggressive in putting things above the cursor instead of below, where basically if you're in the top half of the window, the popup menu is below the cursor, while if you're in the bottom half, the popup menu is always above the cursor.

My question is, how do I control this behavior? It seems like it's probably a vim setting, but in all of my searching I couldn't find anything that would hint at how vim decides whether to put the popup menu above or below the cursor.


Solution

  • The only completion-related options are 'complete' and 'completeopt'. The placement of the complete popup menu is hard-coded in Vim's source code.

    If you think this has changed for the worse in a recent Vim version, please open an issue at the bug tracker, or directly discuss this on the vim_dev mailing list.