Syntastic close error window and original file window
Asked Answered
P

3

6

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.

Polecat answered 24/3, 2015 at 18:46 Comment(1)
:q closes the current window, not Vim.Bircher
K
5

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.

Karimakarin answered 24/3, 2015 at 19:2 Comment(3)
Actually, :q in the main window does close both windows, that's a feature of syntastic. The same doesn't work in the error window because it isn't safe. :q in the error window should still close the error window; the fact that it doesn't, is a bug. :) I'll commit a patch soon.Sextuplet
@Sextuplet No..... the :q in the main window does not close both the windows. The error window still remains open. Also, :q in error window does not close anything. Both the windows remain open. Is the behavior dependent on specific vim version ?Polecat
@Nilesh Bhave: It's supposed to behave the way I described, depending on syntastic version, on interaction with other plugins, and on absence of bugs. Sadly, the bug I mentioned above is not as easy to fix as I first thought. If you have other problems to report, please do so at the issue tracker.Sextuplet
E
4

Try the below command:

:lclose

Emplacement answered 13/4, 2015 at 22:33 Comment(0)
Z
3

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

:SyntasticReset
Zeb answered 14/10, 2016 at 9:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.