KLEIN Stéphane wrote:
Hello,
I look for make all windows (almost) equally high only. I would not
equally wide. There is this feature ? I would not CTRL-W_= because
this command make equally high and wide.
Thanks for your help
Stephane
:set equalalways eadirection=ver
:split
:q
'equalalways' keeps windows equally high and/or wide when splitting or closing
windows
'eadirection' set to "ver" makes 'equalalways' apply only to the height of
windows; their width is not affected
":split" followed by ":q" opens and closes one window with a horizontal split,
forcing 'equalalways' to come into play (twice).
Ctrl-W = (or ":wincmd =") is not used because it acts in both directions
regardless of the 'ea' and 'ead' settings.
Note: the above is not perfect: it will not resize windows in a different
column than the current one. If you want to resize all windows vertically,
it's possible (I think) but the programming is uglier:
DISCLAIMER: THE FOLLOWING FUNCTION IS UNTESTED.
function EquallyHighWindows()
" save 'lazyredraw' and set it ON
" set 'equalalways' and 'eadirection' permanently
let save_lz = &lz
set lz ea ead=ver
" save current window number
let winnr = winnr()
" go to first window
wincmd w
" loop through all windows
while 1
" open and close
below split
q
" if in last window, break out of loop
if winnr() == winnr('$')
break
endif
" go to next window
wincmd w
endwhile
" return to window where we were before
exe winnr . 'wincmd w'
" restore 'lazyredraw' but not the other options
let &lz = save_lz
" clear and force-redraw
redraw!
endfunction
Note that ":windo" cannot be used here because commands executed under
":windo" cannot open or close windows.
Best regards,
Tony.