How do I swap the position of two windows?
Answer
<C-w>r
Explanation
The <C-w>r command rotates windows in the current row or column. This effectively swaps the positions of windows.
How it works
<C-w>rrotates windows downward/rightward<C-w>Rrotates in the opposite direction<C-w>xexchanges the current window with the next one
Example
With two horizontal splits (file A on top, file B below), <C-w>r moves file B to the top and file A to the bottom.
Tips
<C-w>xexchanges with the next window (more targeted)<C-w>H/J/K/Lmoves the current window to the far left/bottom/top/right- These uppercase versions change the layout structure
<C-w>Hconverts a horizontal split to vertical