Vim Window Commands Cheatsheet

Creating and Closing Windows

Command Description
:split or :sp Split window horizontally
:vsplit or :vs Split window vertically
:new Create new window (horizontal split)
:vnew Create new window (vertical split)
Ctrl-w s Split window horizontally (like :split)
Ctrl-w v Split window vertically (like :vsplit)
:q or :close Close current window
:only or Ctrl-w o Close all windows except the current one

Navigating Between Windows

Command Description
Ctrl-w h Move to the window on the left
Ctrl-w j Move to the window below
Ctrl-w k Move to the window above
Ctrl-w l Move to the window on the right
Ctrl-w w Cycle through all windows
Ctrl-w p Move to the previous (last accessed) window
Ctrl-w t Move to the top-left window
Ctrl-w b Move to the bottom-right window

Resizing Windows

Command Description
Ctrl-w = Make all windows equal size
Ctrl-w _ Maximize height of current window
Ctrl-w | Maximize width of current window
:resize or :res Resize window to N rows
:vertical resize or :vert res Resize window to N columns
Ctrl-w + Increase window height
Ctrl-w - Decrease window height
Ctrl-w > Increase window width
Ctrl-w < Decrease window width

Moving Windows

Command Description
Ctrl-w r Rotate windows downwards/rightwards
Ctrl-w R Rotate windows upwards/leftwards
Ctrl-w x Exchange current window with next one
Ctrl-w H Move current window to far left
Ctrl-w J Move current window to bottom
Ctrl-w K Move current window to top
Ctrl-w L Move current window to far right