当我离开插入模式时,我使用自动命令关闭预览窗口,如本答案中所述.但是当我在命令行窗口(q:
)中时,我收到一个错误:E11: Invalid in the command-line window; <CR> executes, CTRL-C quits: :pclose|endif
我该如何防止此错误?
我尝试:set
在命令行窗口和常规窗口中运行,但没有明显的选项在diff中显示出来.
使用silent!
取消错误:
autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif
Run Code Online (Sandbox Code Playgroud)