15

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 (:vsplit) and above (:split)? 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
  • 2
    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
    Commented May 1, 2018 at 14:15
  • Might be interested in post from r/vim: Awesome way to navigate windows and auto-create window Commented May 1, 2018 at 15:32
  • 1
    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.
    – 3N4N
    Commented Jun 8, 2018 at 6:24

1 Answer 1

1

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 and acknowledge you have read our privacy policy.

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