27

Emacs usualy automaticaly splits the window horizontaly.

How can I change this default behaviour, so that the window is splited verticaly by default?

4
  • 4
    I don't know what you mean, but you can hit C-x 2 to split a window vertically, and C-x 3 to split a window horizontally.
    – mqp
    Nov 3, 2011 at 15:37
  • 1
    Some functions do automatically split the screen. As examples of such, there is magit, slime and rinari
    – Pedro Rolo
    Nov 3, 2011 at 15:55
  • 2
    This will be helpful too. It doesn't change the default behavior, but it helps to toggle from horizontal to vertical and vice-versa. emacswiki.org/emacs/ToggleWindowSplit
    – aartist
    Nov 3, 2011 at 16:10
  • Possible duplicate of Setting Emacs Split to Horizontal
    – Bae
    Jan 30, 2018 at 2:43

3 Answers 3

25

Use (setq split-width-threshold nil) for vertical split.
Use (setq split-width-threshold 1 ) for horizontal split.

Use http://www.emacswiki.org/emacs/ToggleWindowSplit to toggle between them.
Use http://www.emacswiki.org/emacs/TransposeWindows to transponse them.

2
  • 1
    Isn't it the opposite? ((setq split-width-threshold 1) for vertical split)
    – ghilesZ
    May 17, 2018 at 8:39
  • 5
    @ghilesZ I had the same reaction, but it can be understood both ways : splitting "horizontally" or "vertically" is always misleading. If you draw a vertical line, the split is horizontal (one part on the left, the other on the right). But one could also say drawing a vertical line does a vertical split. No idea how to settle this ;-) As for the configuration directive, (setq split-width-threshold 1 ) draws a vertical line.
    – Httqm
    Jun 7, 2020 at 11:55
23
M-x Customize-Group [RET] Windows

There you have Split Window Preferred Function, Split Height Threshold and Split Width Threshold. Set Split Height Threshold to nil and Split Width Threshold to 0

3
  • Btw, on saving via Customize I get an error: split-width-threshold in emacs 24.4.1. Nov 25, 2015 at 11:00
  • @KostiantynRybnikov Sorry, could not reproduce that in 24.4.1. It still works for me. Dec 16, 2015 at 15:39
  • 1
    Awesome, just had this problem with magit opening a new window below instead of on the right. Simply increased split-height-threshold from its default 80 to 200. Thanks! :-)
    – troglobit
    Mar 28, 2016 at 10:28
11

For me it worked with

(setq split-width-threshold 0)
(setq split-height-threshold nil)

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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.