Doom-emacs: Magit opens with a vertical split on home page

Created on 23 Mar 2018  路  8Comments  路  Source: hlissner/doom-emacs

Steps to reproduce

  1. Open emacs (maximized)
  2. SPC g S
  3. Navigate to and open any git repo on your sytsem

Observed behavior

Magit opens with a vertical split (that is it takes up the bottom half of the frame)

Expected/desired behavior

I would prefer magit to open with a horizontal split (that is I want it to take up the right half of the frame)

System information

My config can be found here: https://github.com/azy2/doom-emacs-private in-case this is my fault.

Any help would be appreciated.

:ui popup obsolete elisp resolved

Most helpful comment

That's the default setting. To open with horizontal split, add the following to your config:

  (set! :popup "^.*magit" '((slot . -1) (side . right) (size . 80)) '((select . t)))
  (set! :popup "^\\*magit.*popup\\*" '((slot . 0) (side . right)) '((select . t)))
  (set! :popup "^.*magit-revision:.*" '((slot . 2) (side . right) (window-height . 0.6)) '((select . t)))
  (set! :popup "^.*magit-diff:.*" '((slot . 2) (side . right) (window-height . 0.6)) '((select)))

You can tweak the size (window width) to the value you want.

All 8 comments

That's the default setting. To open with horizontal split, add the following to your config:

  (set! :popup "^.*magit" '((slot . -1) (side . right) (size . 80)) '((select . t)))
  (set! :popup "^\\*magit.*popup\\*" '((slot . 0) (side . right)) '((select . t)))
  (set! :popup "^.*magit-revision:.*" '((slot . 2) (side . right) (window-height . 0.6)) '((select . t)))
  (set! :popup "^.*magit-diff:.*" '((slot . 2) (side . right) (window-height . 0.6)) '((select)))

You can tweak the size (window width) to the value you want.

Will the above snippet help with Magit popping up alongside a Cider REPL buffer (they are implemented with the custom popup code in Doom believe?).

2018-03-24-15 18 37-ad0590676fcc

Magit is unusable at this size for me. Closing the Cider REPL window and running magit-status again fixes things with Magit showing up in one of my other splits.

A small tweak to @fuxialexander's rules should do the trick:

(set! :popup "^.*magit" '((slot . -1) (vslot . 1) (side . right) (size . 80)) '((select . t)))
(set! :popup "^\\*magit.*popup\\*" '((slot . 0) (vslot . 1) (side . right)) '((select . t)))
(set! :popup "^.*magit-revision:.*" '((slot . 2) (vslot . 1) (side . right) (window-height . 0.6)) '((select . t)))
(set! :popup "^.*magit-diff:.*" '((slot . 2) (vslot . 1) (side . right) (window-height . 0.6)) '((select)))

The property to pay attention to is vslot, which determines where (vertically) the popup is opened. vslot defaults to 0, and any two popups with the same vslot will be shown side-by-side, like you are seeing. A higher vslot means "further away from the center of the frame", and a lower vslot (including negative numbers) means "closer to the center of the frame".

slot is similar, but controls horizontal positioning. Higher slot = further right, lower slot = further left.

Hope that helps!

I believe the latest magit update changed the name of some buffers and removed the * in the names.
If running the latest magit, you might need this rule instead:

(set! :popup "magit" '((slot . -1) (vslot . 1) (side . right) (size . 80)) '((select . t)))

Notice that ^.*magit has changed to "magit". You might need to adapt more names.

@UndeadKernel ^.*magit should works, the * here is not a escaped \\*, it's for greedy matching.

@fuxialexander Duh, you are right. My regex-fu was absent today. I'll blame it on the change to summer time. Yes, indeed, it's because we just changed to summer time...

@azy2 Can I consider this issue resolved?

Yes! Thanks everyone for the help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nasoundead picture nasoundead  路  3Comments

idoo picture idoo  路  3Comments

gueorgui picture gueorgui  路  3Comments

randomizedthinking picture randomizedthinking  路  3Comments

luisenrike picture luisenrike  路  3Comments