Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide branch from modeline?

Tags:

emacs

magit

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.

like image 336
slinkp Avatar asked Jul 25 '26 23:07

slinkp


2 Answers

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!

like image 200
slinkp Avatar answered Jul 27 '26 14:07

slinkp


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) ""))
like image 39
legoscia Avatar answered Jul 27 '26 13:07

legoscia