4

当我离开插入模式时,我使用自动命令关闭预览窗口,如本答案中所述。但是当我在命令行窗口 ( q:) 中时,我得到一个错误:E11: Invalid in the command-line window; <CR> executes, CTRL-C quits: :pclose|endif

我怎样才能防止这个错误?

我尝试:set在命令行窗口和常规窗口中运行,但没有明显的选项在差异中显示出来。

4

1 回答 1

6

用于silent!抑制错误:

autocmd CursorMovedI *  if pumvisible() == 0|silent! pclose|endif
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif
于 2012-07-31T05:16:11.987 回答