Variable: magit-buffer-name-format

magit-buffer-name-format is a customizable variable defined in magit-mode.el.

Value

"%x%M%v: %t%x"

Documentation

The format string used to name Magit buffers.

The following %-sequences are supported:

%m The name of the major-mode, but with the -mode suffix
     removed.

%M Like "%m" but abbreviate magit-status-mode as magit.

%v The value the buffer is locked to, in parentheses, or an
     empty string if the buffer is not locked to a value.

%V Like "%v", but the string is prefixed with a space, unless
     it is an empty string.

%t The top-level directory of the working tree of the
     repository, or if magit-uniquify-buffer-names is non-nil
     an abbreviation of that.

%x If magit-uniquify-buffer-names is nil "*", otherwise the
     empty string. Due to limitations of the uniquify package,
     buffer names must end with the path.

The value should always contain "%m" or "%M", "%v" or "%V", and
"%t". If magit-uniquify-buffer-names is non-nil, then the
value must end with "%t" or "%t%x". See issue #2841.

This is used by magit-generate-buffer-name-default-function. If another magit-generate-buffer-name-function is used, then it may not respect this option, or on the contrary it may support additional %-sequences.

This variable was added, or its default value changed, in magit version 2.12.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defcustom magit-buffer-name-format "%x%M%v: %t%x"
  "The format string used to name Magit buffers.

The following %-sequences are supported:

`%m' The name of the major-mode, but with the `-mode' suffix
     removed.

`%M' Like \"%m\" but abbreviate `magit-status-mode' as `magit'.

`%v' The value the buffer is locked to, in parentheses, or an
     empty string if the buffer is not locked to a value.

`%V' Like \"%v\", but the string is prefixed with a space, unless
     it is an empty string.

`%t' The top-level directory of the working tree of the
     repository, or if `magit-uniquify-buffer-names' is non-nil
     an abbreviation of that.

`%x' If `magit-uniquify-buffer-names' is nil \"*\", otherwise the
     empty string.  Due to limitations of the `uniquify' package,
     buffer names must end with the path.

The value should always contain \"%m\" or \"%M\", \"%v\" or \"%V\", and
\"%t\".  If `magit-uniquify-buffer-names' is non-nil, then the
value must end with \"%t\" or \"%t%x\".  See issue #2841.

This is used by `magit-generate-buffer-name-default-function'.
If another `magit-generate-buffer-name-function' is used, then
it may not respect this option, or on the contrary it may
support additional %-sequences."
  :package-version '(magit . "2.12.0")
  :group 'magit-buffers
  :type 'string)