Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to close all locations lists and quick fix windows with a single command in vim/gvim?

share|improve this question
:windo if &buftype == "quickfix" || &buftype == "locationlist" | lclose | endif

That will execute the :lclose command in all windows not displaying quickfix or location lists. I didn't have a set of location lists to test it with, so I tested with a different buffer type and it worked for that case.

You will probably want to make it a command or shortcut in your .vimrc as well.

share|improve this answer
:windo if &buftype != "quickfix" | lclose | endif

That will execute the :lclose command in all windows not displaying quickfix or location lists. I didn't have a set of location lists to test it with, so I tested with a different buffer type and it worked for that case.

share|improve this answer
    
Reread the question, he's asking to close all of the quick fix windows, not close everything but them. – deterb Jun 6 '14 at 14:42

:ccl | lcl

Map it to <Leader>c:

noremap <Leader>c :ccl <bar> lcl<CR>

share|improve this answer
    
This will only close one location list: the one for the active window, if one exists. – ches Feb 6 '15 at 15:08

I map this to <F11>:

nmap <F11> :windo lcl\|ccl<CR>

Basically: In each window, run lcl (close location list) and ccl (close quickfix)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.