tags:

views:

1358

answers:

3

How can you switch your to current windows from horizontal split to vertical split and vice versa in Vim?

I did that a moment ago by accident but I cannot find the key again.

A: 

If you have two windows open, you can quit one of them with :q.

Looking in /usr/share/vim/vim72/doc/index.txt.gz I only find a reference to

|CTRL-W_v| CTRL-W v
split current window vertically, new window N lines wide

but no corresponding horizontal split.

hlovdal
I guess this is not what OP asked.
seg.server.fault
Yes, I misunderstood at first as if he had splitted by accident and wanted to "get out" (happens to me some times).
hlovdal
+8  A: 

Vim mailing list says:

To change two vertically split windows to horizonally split

    ^Wt^WK

Horizontally to vertically:

    ^Wt^WH

where ^W means "hit Ctrl-W". Explanations:

    ^Wt     makes the first (topleft) window current
    ^WK     moves the current window to full-width at the very top
    ^WH     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 ^Wt part because if you're already in one of only two windows, what's the point of making it current?

Mark Rushakoff
So if you have two windows split horizontally, and you are in the lower window, you just use ^WL.
too much php
I cannot get ^WL to work.
Masi
+1  A: 

In 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 s
...
Anon
The command ^W-o is great! I did not know it.
Masi