Open GoogleCodeExporter opened 9 years ago
I fully agree that such :windo extension as provided by your s:Windo() function
is necessary for most plugin uses. My ArgsAndMore plugin
(http://www.vim.org/scripts/script.php?script_id=4152) provides such extended
:Windo command (and :Bufdo, :Argdo, :Tabdo, etc.) also for interactive use.
Besides saving and restoring the original and previous windows, the window
layout may also be affected by :windo; namely, windows with a height / width of
0 (frequently used in "Rolodex mode") will increase to size 1 by entering. This
can be undone by wrapping the :windo with this:
let l:originalWindowLayout = winrestcmd()
windo ...
silent! execute l:originalWindowLayout
Full implementation:
+function! s:Windo(command)
+ let l:originalWindowLayout = winrestcmd()
+ let curaltwin = winnr('#') ? winnr('#') : 1
+ let currwin = winnr()
+ execute 'windo ' . a:command
+ execute curaltwin . 'wincmd w'
+ execute currwin . 'wincmd w'
+ silent! execute l:originalWindowLayout
+endfunction
Original comment by sw...@ingo-karkat.de
on 20 Mar 2015 at 7:12
Original issue reported on code.google.com by
dhahler@gmail.com
on 20 Mar 2015 at 6:52