sponsor Vim development Vim logo Vim Book Ad

ProportionalResize : Adapt the window proportions after Vim is resized.

 script karma  Rating 0/0, Downloaded by 129    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
When Vim itself is resized, the rightmost and bottom windows receive or lose
the change in size; all other windows maintain their size as long as possible.
What you usually want is that _all_ window heights and widths are adapted, so
that the proportions of the windows remain constant.

This plugin defines a :ProportionalResize command that wraps Ex commands
    :set lines=40 columns=80
    :simalt ~m
and scales the window sizes to the new dimensions. It also records the window
layout during brief pauses and is then able to auto-adapt after spontaneous
resizings through the mouse or window manager.

Inspired by the following Stack Overflow question:

:ProportionalResize {resize-cmd}
                        Execute {resize-cmd} (e.g. :setlocal lines=40) and
                        adapt the proportions of the current window layout to
                        the new size. So if for example you have 3 windows
                        split vertically 1:1:2, and a horizontal split 4:1,
                        the proportions will be kept instead of the rightmost
                        and bottom windows getting all the space increases.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim ProportionalResize*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.3 or higher and the +float feature.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.000 or

For a permanent configuration, put the following commands into your vimrc:

The plugin can also handle spontaneous resizings (i.e. when you simply use the
mouse or your window manager's controls to resize the GVIM application / Vim
terminal window). For that, it needs to record the original window
proportions. By default, that is done whenever you pause operation
(CursorHold). If you're too impatient, you can add additional events (but
balance that with the drag on performance), e.g. WinEnter:
    let g:ProportionalResize_RecordEvents = 'CursorHold,CursorHoldI,WinEnter'
If you don't want this auto-adaptation at all, and only use the
:ProportionalResize wrapper:
    let g:ProportionalResize_RecordEvents = ''

To make the auto-adaptation react faster, the plugin decreases the
'updatetime' option temporarily while Vim is being resized. To influence the
delay, modify:
    let g:ProportionalResize_UpdateTime = 500

If you have any plugins or mappings that alter the size of the Vim window
(e.g. a :Fullscreen or :Maximize command) it's advisable to trigger it
through the :ProportionalResize wrapper.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ProportionalResize-1.00.vmb.gz 1.00 2013-03-04 7.0 Ingo Karkat Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo