You are on page 1of 3

9/20/2019 ProportionalResize - Adapt the window proportions after Vim is resized.

: vim online

not logged in (login)


ProportionalResize : Adapt the window proportions after Vim is resized.
Custom Search
Search script karma Rating 0/0, Downloaded by 1026 Comments, bugs, improvements Vim wiki

Home created by
Advanced search Ingo Karkat
About Vim
script type
Community
News utility
Sponsoring
Trivia description
Documentation DESCRIPTION
Download 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.
Scripts What you usually want is that _all_ window heights and widths are adapted, so
Tips that the proportions of the windows remain constant.
My Account

Site Help This plugin defines a :ProportionalResize command that wraps Ex commands
like
:set lines=40 columns=80
:simalt ~m
:Fullscreen
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.

SOURCE
Inspired by the following Stack Overflow question:
http://stackoverflow.com/questions/14649698/how-to-resize-split-windows-in-vim-proportionally

USAGE
: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
https://www.vim.org/scripts/script.php?script_id=4462 1/3
9/20/2019 ProportionalResize - Adapt the window proportions after Vim is resized. : vim online

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.

:NoProportionalResize {resize-cmd}
Execute {resize-cmd} (e.g. :setlocal lines=40) without
adapting the proportions of the current window layout.
You can wrap commands which would confuse the plugin's
algorithm (e.g. a rotate function that switches
vertical with horizontal windows), so that it won't
automatically adapt the window layout.

install details
INSTALLATION
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.

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

CONFIGURATION
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:

https://www.vim.org/scripts/script.php?script_id=4462 2/3
9/20/2019 ProportionalResize - Adapt the window proportions after Vim is resized. : vim online

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

INTEGRATION
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 rate

script versions (upload new version)

Click on the package to download.

package script date Vim user release notes


version version
ProportionalResize-1.01.vmb.gz 1.01 2014-05-23 7.0 Ingo - Add :NoProportionalResize command.
Karkat - BUG: Always restore the original
'updatetime' option value after the resize.
Otherwise, the lower value may persist,
e.g. when the "Stale window dimensions
record" error is given.
ProportionalResize-1.00.vmb.gz 1.00 2013-03-04 7.0 Ingo Initial upload
Karkat
ip used for rating: 88.27.192.197

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.

https://www.vim.org/scripts/script.php?script_id=4462 3/3

You might also like