2012-07-31 1123 views
4

我使用自動命令關閉預覽窗口,當我離開插入模式時,如this answer中所述。但是當我在命令行窗口中(q:)時,出現錯誤:E11: Invalid in the command-line window; <CR> executes, CTRL-C quits: :pclose|endif如何防止我的vim autocmd在命令行窗口中運行?

如何防止此錯誤?

我試着在命令行窗口和常規窗口中運行:set,但沒有明顯的選項在diff中顯示。

回答

5

使用silent!取消錯誤:

autocmd CursorMovedI * if pumvisible() == 0|silent! pclose|endif 
autocmd InsertLeave * if pumvisible() == 0|silent! pclose|endif 
+1

當然!謝謝。 – idbrii 2012-07-31 05:20:17

相關問題