Syntastic close error window and original file window

丶灬走出姿态 提交于 2019-12-07 02:02:49

问题


I've installed Syntastic from GitHub and I'm trying to use Syntastic for checking perl syntax errors (and planning to use for Python in a short while). When I use ':quit' or ':q', only original file window closes. The error window does not close. Below is snip from my .vimrc file :

execute pathogen#infect()  
set statusline+=%#warningmsg#  
set statusline+=%{SyntasticStatuslineFlag()}  
set statusline+=%*  
let g:syntastic_perl_checkers = ['perl']  
let g:syntastic_python_checkers = ['pylint']  
let g:syntastic_enable_perl_checker = 1  
let g:syntastic_always_populate_loc_list = 1  
let g:syntastic_auto_loc_list = 1  
let g:syntastic_check_on_open = 1

Since I'm very new to vim scripting, I would like to know how to close both windows, error window and original file window, when I use ':quit' or ':q' while original file window is active.


回答1:


That's the normal Vim behavior; it has nothing to do with Syntastic. The quickfix or location list windows may contain references to other files, so it is not certain that you want to completely leave Vim when quitting from the originating window.

The simplest solution is using :qa (quit all) instead of :q. As the error window doesn't contain unpersisted changes, this is safe and doesn't require a confirmation.

If you are annoyed by having to think about this, you can use Vim's scripting capabilities to change its behavior:

:autocmd WinEnter * if &buftype ==# 'quickfix' && winnr('$') == 1 | quit | endif

This checks on each change of window whether there's only one window left, and if that one is a quickfix / location list, it quits Vim.




回答2:


Try the below command:

:lclose




回答3:


According to Syntastic help, the command to close Syntastic error window is:

:SyntasticReset


来源:https://stackoverflow.com/questions/29240526/syntastic-close-error-window-and-original-file-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!