Nov 24, 2013 | stackoverflow.com
ДМИТРИЙ МАЛИКОВ, Nov 24, 2013 at 7:55
How can you switch your current windows from horizontal split to vertical split and vice versa in Vim?Mark RushakoffI did that a moment ago by accident but I cannot find the key again.
Vim mailing list says (re-formatted for better readability):
- To change two vertically split windows to horizontal split: Ctrl - W t Ctrl - W K
- Horizontally to vertically: Ctrl - W t Ctrl - W H
Explanations:
- Ctrl - W t -- makes the first (topleft) window current
- Ctrl - W K -- moves the current window to full-width at the very top
- Ctrl - W H -- moves the current window to full-height at far left
Note that the t is lowercase, and the K and H are uppercase.
Also, with only two windows, it seems like you can drop the Ctrl - W t part because if you're already in one of only two windows, what's the point of making it current?
Too much php Aug 13 '09 at 2:17
Alex Hart Dec 7 '12 at 14:10So if you have two windows split horizontally, and you are in the lower window, you just use ^WL
There are a ton of interesting ^w commands (b, w, etc)
holms Feb 28 '13 at 9:07
somehow doesn't work for me.. =/ –
Lambart Mar 26 at 19:34
Just toggle your NERDTree panel closed before 'rotating' the splits, then toggle it back open. :NERDTreeToggle (I have it mapped to a function key for convenience).
^wfollowed by capitalH,J,KorLwill move the current window to the farleft,bottom,toporrightrespectively like normal cursor navigation.The lower case equivalents move focus instead of moving the window.
respectTheCode, Jul 21 '13 at 9:55
1 Wow, cool! Thanks! :-) – infous Feb 6 at 8:46 it's much better since users use hjkl to move between buffers. – Afshin MehrabaniIn VIM, take a look at the following to see different alternatives for what you might have done:
:help opening-window
For instance:
Ctrl - W s
Ctrl - W o
Ctrl - W v
Ctrl - W o
Ctrl - W sAnon, Apr 29 at 21:45
The command ^W-o is great! I did not know it. – Masi Aug 13 '09 at 2:20 add a comment | up vote 6 down vote The following ex commands will (re-)split any number of windows:
- To split vertically (e.g. make vertical dividers between windows), type
:vertical ball- To split horizontally, type
:ballIf there are hidden buffers, issuing these commands will also make the hidden buffers visible.
Mark Oct 22 at 19:31
When you have two or more windows open horizontally or vertically and want to switch them all to the other orientation, you can use the following:
- :windo wincmd K (switch to vertical)
- :windo wincmd H -- It's effectively going to each window individually and using ^WK or ^WH