Vim Move Split

3.4
(528)

You’re probably familiar with Vim’s split capability which allows splitting your screen vertically, horizontally, or both. (See :help split.) But once you’ve split your screen, it can be helpful to move splits around to get a better view. I often find myself with working in a small corner of my screen. If I want to move a Vim split to a different position to get a better view, there are several shortcuts worth internalizing:

  • ctrl-w H moves the active split to a full-height split across the left
  • ctrl-w J moves the active split to a full-width split across the bottom
  • ctrl-w K moves the active split to a full-width split across the top
  • ctrl-w L moves the active split to a full-height split across the right

You can see that the shortcut keys are the same H J K L you’re used to using for movement, making them easier to remember. Just remember to use capital for the second key, so press shift.

Here’s a short screencast showing a screen split 4 splits. My cursor is in the Vim split on the right side and I want to move it around to a different position.

Demo of Moving Vim Splits

First I press ctrl-w K in Vim to move the split across the top, then ctrl-w J to move the same split across the bottom. Then ctrl-w H to move it to the left position and finally ctrl-w L to move it back to the right side.

These shortcuts are foundational split keys that every Vim user should master. But be sure to checkout many of our other tips and tricks about Vim splits including: Splitting to a specific size, Maximizing the current split, and Opening splits more naturally.

How do I move the current split in Vim?

You can move the currently active Vim split by pressing ctrl-w followed by a capitalized movement key: H, J, K, or L:

  • ctrl-w H moves the active split to a full-height split across the left
  • ctrl-w J moves the active split to a full-width split across the bottom
  • ctrl-w K moves the active split to a full-width split across the top
  • ctrl-w L moves the active split to a full-height split across the right

What are the ctrl-w K Vim docs?

CTRL-W K: Move the current window to be at the very top, using the full width of the screen. This works like closing the current window and then creating another one with :topleft split, except that the current window contents is used for the new window.

What are the ctrl-w J Vim docs?

CTRL-W J Move the current window to be at the very bottom, using the full width of the screen. This works like closing the current window and then creating another one with :botright split, except that the current window contents is used for the new window.

What are the ctrl-w H Vim docs?

CTRL-W H Move the current window to be at the far left, using the full height of the screen. This works like closing the current window and then creating another one with :vert topleft split, except that the current window contents is used for the new window.

What are the ctrl-w L Vim docs?

CTRL-W L Move the current window to be at the far right, using the full height of the screen. This works like closing the current window and then creating another one with :vert botright split, except that the current window contents is used for the new window.

How useful was this tip?

Average rating 3.4 / 5. Vote count: 528

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Andy Libby

36 Posts

Rider of bicycles. Writer of code. User of Vim.
View all posts