使用 :q, :q! 时完全退出 Syntastic 创建的位置列表 (lcl) 以及主缓冲区或:wq!在VIM中
我正在使用 Syntastic 插件。我有一些文件存在一些我无法更改的错误(警告)。当我打开一个带有错误消息的文件,并且按 :q 退出文件(缓冲区)时,错误消息仍然可见(另一个缓冲区),因此在编辑文件时我必须按 :q 两次才能完全退出。
那么,如何对一个包含我的文件的缓冲区和另一个包含语法错误的缓冲区(位置列表)的文件按一次 :q ?我搜索了一下,关闭位置列表的命令是 :lcl。
当我使用 :q 退出缓冲区时,如果该缓冲区的位置列表处于活动状态,我想使用其中的位置列表关闭它,调用 :lcl。我正在阅读一些 autocmd BufLeave
和 BufWinLeave并尝试为此创建一个映射,但我不知道两者之间的区别。有人可以帮助我吗?
请记住,:w、:q、:q!、:wq
应该都按预期工作。
I'm using Syntastic plugin. I have some files with some errors (Warnings) that I can't change. When I have a file opened with error messages, and I quit the file(buffer) pressing :q, the error messages are still visible(another buffer), so I have to press :q twice to completely exit when editing a file.
So, how do I press :q just once with a file with a buffer containing my file and another buffer (location list) containing Syntastic errors? I've searched a little bit and the command to close the location list is :lcl.
When I exit a buffer with :q, if the location list for that buffer is active, I want to close it with the location list within, calling :lcl. I'm reading some autocmd BufLeave
and BufWinLeave
and trying to create a mapping for this, but I cant know the difference between the two. Can someone help me?
Remembering, :w, :q, :q!, :wq
should all work as intended.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 lcl 工作,即使没有错误窗口,您也可以将 q 映射到 lcl 和 q
正如建议的那样,缩写似乎更好
(注意 | 之前的 \ ,如果没有它,缩写就会退出)
As lcl work even if there is no error window you can map q to lcl and q
As suggested an abbreviation seems better
(note the \ before |, without it does the abbreviation then quit )
我意识到这个问题很老了,而且答案不久前就被接受了。我尝试使用已接受的答案,但它似乎不再起作用。
不过,我确实从这个问题,如果其他人遇到这个问题。
基本上,使用脚本检查是否有任何其他剩余窗口打开,如果最后一个剩余窗口是位置列表,则退出。
我认为这可能并不理想,但同时效果很好。
I realize this question is old and that the answer was accepted sometime ago. I tried using the accepted answer but it does not seem to work any more.
I did however find a workaround from this question, should others run in to this.
Basically, use a script to check if there are any other remaining windows open and if the last remaining window is a location-list, quit.
I think this may not be ideal but works well enough in the meantime.