I realized that my first post changed the height of the window, not the width. That's what I meant:
Here is a quick solution that I came up with, but it is not perfect. The function counts the number of open windows, and then sets the window width to original_width * num_windows
. Auto-commands invoke a function when Vim starts, and whenever a new window opens. You can change the default window width (80) to suit your needs.
function! SmartWidth( width ) let num_wins = 0 windo let num_wins+=1 sil exe "set columns=" . num_wins * a:width sil exe "normal! \<cw>=" endfunction autocmd VimEnter * call SmartWidth(80) autocmd WinEnter * call SmartWidth(80)
This works in the main case, but does not distinguish between horizontal and vertical splits. I do not know how to do that!
source share