1

Usually I am editing two files, A and B, split horizontally. I set it up, so that one buffer would only occupy the first 2 lines at the top of the screen, and the rest is for the other buffer.

Sometimes I need to edit a third file, C, which is to have half the screen realestate of the big buffer, split vertically. The following roughly shows what I would like to end up with.

------------------------------------------------------------------------------
| First  line of file A                                                      |
| Second line of file A                                                      |
------------------------------------------------------------------------------
| First  line of file C               | First  line of file B                |
| Second line of file C               | Second line of file B                |
|        ...                          |       ...                            |
| Last   line of file C               | Last   line of file B                |
------------------------------------------------------------------------------

The problem is, that when I do :vsplit C to split half of the big buffer off for the new file, vim also resizes the buffer showing file A to eat up half the screen and files B and C each get a quater screen.

How do I tell vim to not care about horizontal resizing when doing vertical splits?

EDIT To be more explicit: I am looking to specify the resulting height of a buffer, when doing a vertical split. The vsplit command accepts only width as a parameter, not height.

I can resize windows after opening the new file, but that is rather tedious. The problem becomes more difficult with more open files. I could just stick to editing one file at a time, but I think vim is more powerful than that.

  • what about 30 ctrl+w- (30 is the Number of lines you want to reduce then ctrl and minus ctrl+w- )??? – Thushi Aug 7 '14 at 7:04
  • The answer is given on stackoverflow, here stackoverflow.com/questions/4368690/… – UVV Aug 7 '14 at 7:05
  • @UVV no its not. I know how to supply the width for vertical splits and the height for horitonzal splits. I am asking for height for vertical splits. – Bananguin Aug 7 '14 at 7:11
3

You can turn that default behavior off via

:set noequalalways

You then have to explicitly make windows equal size (e.g. with <C-w>=)

Alternatively, you can just turn this off for the window height via

:set eadirection=hor
  • :set noequalalways is exactly what i was looking for! – Bananguin Aug 7 '14 at 7:39
0

30 ctrl-w+ - increase window size by 30 lines

30 ctrl-w- - decrease window size by 30 lines

  • Yes, I know that. I've just grown a little tired of having to do to things for one action. – Bananguin Aug 7 '14 at 7:12

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.