Moving windows around
You can rearrange windows to get your layout just right — and look, it’s hjkl again! Capitalized this time: <C-w>H, <C-w>J, <C-w>K, and <C-w>L move the current window all the way to the left, bottom, top, or right. These are super useful for turning a horizontal split into a vertical one, or vice-versa.
Two more good ones: <C-w>x exchanges the current window with the next one, and <C-w>r “rotates” all the windows around.
Work through the checklist. To set the stage quickly, we’ll load a handful of numbered files with :args *.txt and open a window for each with :all — more on those two commands in a later lesson.
1 2 3 4 5 6 7
Load the numbered files with :args *.txt Vim will load every matching file and drop you in the first one, 1.txt — type :args *.txt and hit Enter.
Open them all at once with :all One window per loaded file — type :all and hit Enter.
Map W to stand in for <C-w> Type :nnoremap W <C-w> and hit Enter.
Rotate the windows with Wr Every window shuffles along one spot (real Vim, <C-w>r) — press W then r.
Exchange two windows with Wx The current window swaps with the next one (real Vim, <C-w>x) — press W then x.
Throw the current window to the top with WK Real Vim's <C-w>K hoists the current window to the top — press W then shift-K.
Throw it to the far left with WH Press W then shift-H (real Vim, <C-w>H) — the stack turns into a vertical split!
Next: Open them all at once with :all
Next: Map W to stand in for <C-w>
Next: Rotate the windows with Wr
Next: Exchange two windows with Wx
Next: Throw the current window to the top with WK
Next: Throw it to the far left with WH
Last one — goal check runs when it's done
Nice work!
Up next: Popping up a new window for quick notes.