Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

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

autocmd InsertLeave * if pumvisible() == 0|pclose|endif
share|improve this answer
    
+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. –  Merlyn Morgan-Graham Jul 4 '11 at 5:00
    
There probably is, but I don't know. Hopefully some superuser will answer your question. –  Baha Jul 4 '11 at 5:09
    
Check accepted answer at stackoverflow.com/questions/3105307/… Also @Profpatsch answer could work. (It did for me) –  Sebastián Grignoli Dec 30 '12 at 5:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.