Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntastic close error window and original file window

Tags:

vim

syntastic

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.

like image 665
Nilesh Bhave Avatar asked Mar 24 '15 18:03

Nilesh Bhave


3 Answers

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.

like image 143
Ingo Karkat Avatar answered Oct 19 '22 09:10

Ingo Karkat


Try the below command:

:lclose

like image 4
sunjerry Avatar answered Oct 19 '22 09:10

sunjerry


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

:SyntasticReset
like image 3
PokerFace Avatar answered Oct 19 '22 07:10

PokerFace