Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically close the quick fix window when leaving a file?

Tags:

vim

I use a plugin in vim to compile Tex files. When there are errors on compilation, they are all displayed in a quick fix window at the bottom of the screen.

When I want to leave a file I'm working on (:q, :wq, etc) the quickfix window can be annoying because it stays open after I left the buffer of the file I was working on, forcing me to :q on the quick fix window too.

Is there a way to tell vim to immediately execute :close when I use :q? I've tried several autocmds, but to no avail.

like image 859
romeovs Avatar asked Sep 19 '11 19:09

romeovs


2 Answers

Add to your .vimrc file

aug QFClose
  au!
  au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|q|endif
aug END

Warning: this will close vim if the quickfix window is the only window visible (and only tab).

like image 173
Peter Rincker Avatar answered Nov 11 '22 08:11

Peter Rincker


The command :qa will quit all open windows.

like image 3
Dave Rager Avatar answered Nov 11 '22 08:11

Dave Rager