Vim close preview window after omnifunc selection

From Birnam Designs Wiki

Jump to: navigation, search

Some omnifunc matches can show extended information in a scratch Preview window. This is especially useful after matching functions to show the function definition and parameters. To automatically close the preview window, though, you can use one or both of these in your .vimrc or .gvimrc file:

autocmd CursorMovedI * if pumvisible() == 0|pclose|endif 
autocmd InsertLeave * if pumvisible() == 0|pclose|endif

Using only the second command is more useful for completing functions if the function definition is available in the scratch window.

Share This!
This page was last modified on 11 February 2010, at 20:11. This page has been accessed 787 times.