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.
1 Answer
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}
takes 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.