11

When a window is split, given that Vi/Vim splits are not stored in a tree structure, the "direction of the split" is basically "the window in which the cursor is placed after the command".

Update 2018-05-01: @mass clarified that splits are stored in a tree structure and that the direction actually refers to the direction of the "split bar". Thanks!

I however, think of my splits as a, in some way, spatial history of my editing session where time flows from left to right (as in a web browser) and from up to down (like when scrolling a text document)*.

When I split a window, it is usually because I want to reference something based on my current file, and would need to navigate this file before continuing with my work. I think of opening a buffer in a new window is a event that adds to the session history.

Why are Vi's and Vim's defaults left (:split) and above (:vsplit)? Was the decision motivated by technical, UI/workflow, or legacy reasons? Or something completely different? I noticed that the default in Emacs is to split down (C-x 2 is split-window-below) and right (C-x 3 is split-window-right)...

If you know the history behind the defaults, I would be happy if you could share the answer! If you prefer the defaults, please comment on why!

* also reading most current European written languages

3
  • 1
    couple corrections: 1) vim splits are stored in a tree structure (consider the limitations of <c-w>r and <c-w>x) which can be verified by reading the source code. 2) the default for :split is above and for vsplit left. "vertical split" might be ambiguous at first but it refers to the direction of the "split bar." – Mass May 1 '18 at 14:15
  • Might be interested in post from r/vim: Awesome way to navigate windows and auto-create window – Peter Rincker May 1 '18 at 15:32
  • although emacs does split below and right, it doesn not however switch to that split (window?). You'd have to manually do a c-x oto switch to the new window (split?). So, it basically behaves as vim. – klaus Jun 8 '18 at 6:24
0

This is interesting question. To me this is more of intuition.

When I am looking onto the screen and reading, my cursor is at a specific point. Now, I want to open something.

It would be best to open new file in the 'left' as mostly people read from left-to-right (ltr) direction. And as the buffers reset on splitting, we subconsciously reset our eyes to 'left' in case of vertical splitting.

Similar is the case with horizontal split i.e. to open on 'top'.

Of course, you can override this using:

:belowright [v]sp <file>

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.