Managing vim windows

Sjoerd de haan
2 min readApr 6, 2020

--

Multiple windows in Vim *

One of the most productive parts of vim is window management. Window management refers to having multiple windows open.

Having control over the placement of the windows is crucial for productivity. In this article I describe short keys for controlling the windows.

Window basics

If you remember one thing from this article remember this: vim has excellent documentation.

The basics on using windows can be found in chapter 8 of the user manual

:help usr_08.txt

You can always return here. The rest of this article assumes you know the basics of vim windowing.

Window movements

All window movements can be found in the reference manual

:help window-movingWindow movements
exchange windows
ctrl-W r Rotate windows (1 -> 2 -> 3 -> 1)
ctrl-W R Rotate windows backwards (3 -> 2 -> 1-> 3)
crtl-W x Exchange current window with the next one
n crtl-W x Exchange current window with window n (works only if target window is in same row or column)
absolute placement
ctrl-W K Move current window to top of screen. Use full width
ctrl-W H Move current window to bottom of screen. Use full width
ctrl-W J Move current window to left of screen. Use full height
ctrl-W L Move current window to right of screen. Use full height
crtl-W T Move current window to a new tab

Window resizing

All window movements can be found in the reference manual

:help window-resizeRelative
ctrl-W = Equalize size of windows
N ctrl-W - Decrease window size by N
N ctrl-W + Increase window size by +
N ctrl-W < Decrease window size by N
N ctrl-W > Increase window size by +
Absolute
z{nr}<CR> Set size of current window to nr
N ctrl-W _ Set size of current window to N

*source Wikipedia

Conclusion

Takeaway of this article is that you should use window movements and resizing. If you don’t remember the short cut, make use of help instead of returning to this article. The more you use :help, the better you learn vim.

--

--

Sjoerd de haan

Improving life science research with machine learning. Physicist (PhD) and machine learning engineer.