Mike wrote:
On 10/6/06, Aaron Griffin <[EMAIL PROTECTED]> wrote:
On 10/6/06, Mike <[EMAIL PROTECTED]> wrote:
> alternatively: is there a single command to toggle the quickfix
> window, rather than issuing :copen and :ccl?
:help cwindow
The problem with :cwindow is that it depends on what is in the
quickfix window. I just want it to open or close, I don't care what
is in there.
(untested)
function ToggleQuickfix()
" remember where we are
let winnr = winnr()
" find qf window, if any
let qfw = 0
windo if &l:buftype == "quickfix" |
\ let qfw = winnr() | endif
if qfw
" close qf window
cclose
else
" open qf window as last window, fullwidth
bot copen
endif
" go back to where we started from
if (winnr >= qfw) && (winnr > 1)
let winnr = winnr - 1
endif
exe winnr "wincmd w"
endfunction
command -nargs=0 -bar QFToggle call ToggleQuickfix()
If you haven't defined another command starting with the same letters, ":QFT"
ought to be enough to invoke this. (Note: the qf window usually starts as the
last one, but it is possible to open additional windows below it. Hence it's
not enough to check the last window's &buftype.)
Best regards,
Tony.