48

So far, I've figured out swapping splits laterally via CTRL+W x, and that's pretty much it.

How do I move a split anywhere in a viewport that contains multiple vertical and horizontal splits?

How do I create a horizontal split that, say, spans the entire top half of the screen after I have already opened a few vertical splits? (Currently, when I create a new horizontal split in an already-vertically-split viewport, I get a horizontal split in one of the columns.)

Perhaps most vim users prefer tabs over splits, but I really like the latter because I work on a 30" monitor! :-)

35

I suggest you read through the help file for vim windows. The specific sections of that file that apply to your question:

:help opening-window
:help window-moving


Edit: I can only assume this is periodically getting downvotes because I haven't provided specific answers here. The problem is that the original poster asked several questions, and they were broad. The best way to answer all those questions at once is to refer to the Vim documentation, which should always be available wherever Vim is installed.

Also I want to note that I didn't just tell the OP to "RTFM," I provided specific sections of the manual to read, which can be an acceptable answer.

| improve this answer | |
  • 80
    RTFM doesn't answer the question. – poindexter Oct 2 '12 at 15:54
  • 16
    we expect SO to be the manual...it's easy: google for something, open the SO link and get what you came for, without being redirect to another source. – Danny May 30 '13 at 18:58
  • 2
    @NewWorld because SO has hundreds of thousands of devs editing, adding, commenting, making it awesome ;) – Danny Aug 11 '14 at 18:31
  • 3
    @Danny i.e. spoonfeeding. The documentation is great and the answer is there; there's no need to unnecessarily duplicate information. – DBedrenko Aug 13 '14 at 8:37
  • 14
    see: superuser.com/help/how-to-answer "Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline." – j03w Oct 3 '14 at 4:56
67

I'm sure the help file covers it, but to move a split to cover the top of the screen, you can do CTRL-W K (i.e., Ctrl+W Shift+K), with H = left, J = bottom, K = top, L = right (following usual vi/vim conventions).

Note that the letters are uppercase. CTRL-W k (i.e., Ctrl+W K, without Shift) will instead move up between splits, etc.

| improve this answer | |
16

You can do:

:to sp

or

:top split

to do a horizontal window that spans the top of the screen.

| improve this answer | |
  • Thanks both to you and the other poster who gave the first half of the answer. – hakanensari Dec 6 '10 at 22:31
  • Upvote for answering the question, it'd be nice to see this answer combined with Heptile's. – poindexter Oct 2 '12 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.