Moving Splits

Rearrange your splits with familiar directional navigation

You may be familiar with Vim’s split capability which allows splitting your screen vertically, horizontally, or both. (If not, see :help split for an overview.) Once you have split your screen, how can you rearrange your splits? It’s easy with ctrl-w:

  • ctrl-w J moves the active to the bottom

  • ctrl-w H moves the active split to the left

  • ctrl-w K moves the active split to the top

  • ctrl-w L moves the active split to right

  • ctrl-w r rotates splits to the right/down

  • ctrl-w R rotates splits to the left/up

Here’s a short screencast showing a screen split into 3 horizontal splits:

In the screencast, we have focus in the top split. First, use ctrl-w r to rotate the splits down/right which moves our in-focus split to the middle. We repeat ctrl-w r to rotate again and our split is on the bottom. Next, we use the opposite movement: ctrl-w R to rotate up/left, which we again repeat to reposition our split at the top. Last we use ctrl-w J to move our split all the way to the bottom, which accomplishes the same thing as ctrl-w r ctrl-w r, but in one less keystroke.

This is really just scratching the surface of split movements and actions, but this one trick can really help reorganize your screen for maximum efficiency. Stay tuned for further tips and tricks on using splits!


Was this useful? Help us improve!

With your feedback, we can improve VimTricks. Click a link to vote: