27

Emacs usualy automaticaly splits the window horizontaly.

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

Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
  • 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 03 '11 at 15:37
  • 1
    Some functions do automatically split the screen. As examples of such, there is magit, slime and rinari – Pedro Rolo Nov 03 '11 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. http://www.emacswiki.org/emacs/ToggleWindowSplit – aartist Nov 03 '11 at 16:10
  • Possible duplicate of [Setting Emacs Split to Horizontal](https://stackoverflow.com/questions/2081577/setting-emacs-split-to-horizontal) – Bae Jan 30 '18 at 02:43

3 Answers3

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.

aartist
  • 3,145
  • 3
  • 33
  • 31
  • 1
    Isn't it the opposite? (````(setq split-width-threshold 1)```` for vertical split) – ghilesZ May 17 '18 at 08: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 07 '20 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

Ocaso Protal
  • 19,362
  • 8
  • 76
  • 83
11

For me it worked with

(setq split-width-threshold 0)
(setq split-height-threshold nil)
coquin
  • 1,338
  • 1
  • 13
  • 22