62

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! :-)

0

3 Answers 3

42

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.

9
  • 94
    RTFM doesn't answer the question.
    – poindexter
    Oct 2, 2012 at 15:54
  • 20
    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, 2013 at 18:58
  • 3
    @NewWorld because SO has hundreds of thousands of devs editing, adding, commenting, making it awesome ;)
    – Danny
    Aug 11, 2014 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, 2014 at 8:37
  • 21
    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, 2014 at 4:56
86

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.

17

You can do:

:to sp

or

:top split

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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