Hide branch from modeline?

1k Views Asked by At

Magit is eating up a lot of my modeline to display the current git branch ... or at least I think it's magit that's doing so, honestly I can't find any way to tell where it's coming from. I can always find that out other ways and it's pushing out other stuff I would rather have in my modeline (namely which-function-mode).

Is there any way to disable this? I don't see anything relevant in the customize menu or in the magit manual.

4

There are 4 best solutions below

0
On BEST ANSWER

I did finally stumble onto the customizable variable mode-line-format I just moved (vc-mode vc-mode) from the middle to the right and now it's out of my way!

1
On

It's not Magit that's putting the branch in the mode line, but vc-git, more specifically the function vc-git-mode-line-string. I can't see any way to customize it, so the only way to remove the branch name from the mode line is to redefine or advice this function.

For example:

(advice-add 'vc-git-mode-line-string
            :override (lambda (file) ""))
0
On
(setcdr (assq 'vc-mode mode-line-format)
        '((:eval (replace-regexp-in-string "^ Git.*$" " " vc-mode))))

https://emacs.stackexchange.com/questions/10955/customize-vc-mode-appearance-in-mode-line

0
On

You can also remove the vc-mode related part from your modeline entirely:

(setq-default mode-line-format (delete '(vc-mode vc-mode) mode-line-format))