3

The omni-completion feature in gVim (under Windows, with mostly default settings) brings up a second buffer, called [Scratch] [Preview].

When I finish selecting an item from the omni-completion popup menu, this buffer doesn't go away. Currently, I am closing it via:

  • ESC(to get to normal mode)
  • CTRLwk:q

I have seen questions on customizing the buffer height, or keeping it from popping up entirely, but I like the size, and I like having it there while I'm selecting. Is there an easier way to get it to go away after I've selected what I want?

A simpler shortcut under Windows "default" bindings would be best, though careful remaps that aren't likely to interfere with anything would be okay too.

1 Answer 1

13

Add this to your vimrc to auto close the preview window when you exit the insert mode:

autocmd InsertLeave * if pumvisible() == 0|pclose|endif
3
  • +1; This is great :) Out of curiosity, is there any other autocmd I could bind it to that would get it to close even sooner (yet not kill perf)? If not, this is plenty good enough. Jul 4, 2011 at 5:00
  • There probably is, but I don't know. Hopefully some superuser will answer your question.
    – Baha
    Jul 4, 2011 at 5:09
  • Check accepted answer at stackoverflow.com/questions/3105307/… Also @Profpatsch answer could work. (It did for me) Dec 30, 2012 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .