How to flip windows in vim? [duplicate]

If you have them split vertically C-wJ to move one to the bottom

If you have them split horizontally C-wL to move one to the right

To rotate in a 'column' or 'row' of split windows, C-wC-r

The following commands can be used to change the window layout. For example, when there are two vertically split windows, CTRL-W K will change that in horizontally split windows. CTRL-W H does it the other way around.


Ctrl-w H or type :wincmd H to go from horizontal to vertical layout.

Ctrl-w J or type :wincmd J to go from vertical to horizontal layout.

Ctrl-w r or type :wincmd r to swap the two buffers but keep the window layout the same.

Ctrl-w w or type :wincmd w to move the cursor between the two windows/buffers.

You may wish to bind one or more of these sequences to make it faster to type. I put this in my .vimrc so that ,l moves the cursor to the next buffer in the current tab:

let mapleader = ","
nmap <Leader>l <C-w>w