1

When I open a Magit status buffer, then the recent commit section is closed, I need to use TAB to expand it. How can I configure it to always be expanded.

enter image description here

2

The option magit-section-initial-visibility-alist can be used to configure this.

First you have to figure out the sections type using M-x magit-describe-section-briefly while point is on the section in question.

That shows #<magit-section "@{upstream}.." [unpushed status] 372-935>, so the type is unpushed, which is a bit surprising. The "Recent commits" section is actually just the form that the Unpushed to @{upstream} when there aren't actually any commits that haven't been pushed to @{upstream}.

To set the initial visibility use:

(setf (alist-get 'unpushed magit-section-initial-visibility-alist) 'show)

magit-section-initial-visibility-alist only supports setting the visibility based on the type (as opposed to also taking the value (here "@{upstream}..") into account). There can be a second section of type unpushed: Unpushed to <push-remote>. Given the above setting, that is also expanded initially.

  • thanks for your reply. its very useful. – xiaodong huan Aug 7 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.