vimtricks.wiki Concise Vim tricks, one at a time.

How do I rotate split windows forward without reopening any buffers?

Answer

:wincmd r

Explanation

When a split layout is correct but the window positions are awkward, you do not need to close and reopen anything. :wincmd r rotates buffers through the existing window frames, preserving the split structure while cycling which buffer appears where. This is useful during review sessions when you want reference files to move to a different side without disrupting your overall workspace.

How it works

  • :wincmd executes a window command from Ex mode
  • r rotates window contents forward in the current tab page
  • The number and shape of splits stay the same; only buffer placement changes

Think of it as a layout permutation, not a re-split. You keep your editing context, cursor positions, and open windows while changing visual arrangement.

Example

Assume you have three splits open in this order top-to-bottom:

[tests]
[implementation]
[notes]

Run:

:wincmd r

After one rotation, the same three windows remain, but their buffers shift:

[notes]
[tests]
[implementation]

Run it again to continue cycling until the arrangement is convenient.

Tips

  • Use :wincmd R to rotate in the opposite direction
  • Combine with :wincmd = if you also want equalized split sizes
  • This is faster and less error-prone than manually moving through each split with :buffer commands

Next

How do I tune Vim diff so moved code blocks align more accurately?