I'm Matthew J. Morrison.

A Passionate, professional software developer & hobbyist; Language nerd & regular user of Unix, Python, Ruby & JavaScript.

Fork me on GitHub

This is not something that I learned today it is also something that I really do not have committed to memory. It is something that is useful to know which I occasionally look up. I have previously written about using splits in Vim and Tmux. This is somewhat related but rather than focusing on moving your cursor from one pane to another I want to focus on moving the panes themselves.


There are a few different ways to go about moving panes within a window (and moving panes into and out of a window - but that is a topic for another time). The first way is using rotate-window. By default rotate-window is mapped to <tmux-leader> C-o. This will just rotate your panes around the window like this:

Tmux Rotate Window

As you can see, this will keep the pane layout that you have created and move the contents of each pane from one to the next. You can also change the layouts fairly simply in tmux by using one of the five predefined layouts using <tmux-leader> M-# where the # is 1-5. Here is what each of them look like:

Tmux layouts


There are a few keys that you can use to move panes around in Vim: C-w C-# (where # is H, J, K, L, or R). H will move the current pane to the far left, J to the very bottom, K to the very top, L to the far right and R will rotate panes. Be careful with R - it works great when you have 2 panes but can do strange things when there are more. You can also switch from vertical to horizontal splits using the same C-w C-# commands. Here is a brief demo:

Move Vim Panes