Variable: magit-define-global-key-bindings

magit-define-global-key-bindings is a customizable variable defined in magit.el.

Value

default

Documentation

Which set of key bindings to add to the global keymap, if any.

This option controls which set of Magit key bindings, if any, may be added to the global keymap, even before Magit is first used in the current Emacs session.

If the value is nil, no bindings are added.

If \+default, maybe add:

    \C-x \g magit-status
    \C-x \M-g magit-dispatch
    \C-c \M-g magit-file-dispatch

If recommended, maybe add:

    \C-x \g magit-status
    \C-c \g magit-dispatch
    \C-c \f magit-file-dispatch

    These bindings are strongly recommended, but we cannot use
    them by default, because the \C-c <LETTER> namespace is
    strictly reserved for bindings added by the user.

The bindings in the chosen set may be added when after-init-hook is run. Each binding is added if, and only if, at that time no other key is bound to the same command, and no other command is bound to the same key. In other words we try to avoid adding bindings that are unnecessary, as well as bindings that conflict with other bindings.

Adding these bindings is delayed until after-init-hook is run to allow users to set the variable anywhere in their init file (without having to make sure to do so before magit is loaded or autoloaded) and to increase the likelihood that all the potentially conflicting user bindings have already been added.

To set this variable use either setq or the Custom interface. Do not use the function customize-set-variable because doing that would cause Magit to be loaded immediately, when that form is evaluated (this differs from custom-set-variables, which doesn't load the libraries that define the customized variables).

Setting this variable has no effect if after-init-hook has already been run.

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

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit.el
;;; Global Bindings

;;;###autoload
(defcustom magit-define-global-key-bindings 'default
  "Which set of key bindings to add to the global keymap, if any.

This option controls which set of Magit key bindings, if any, may
be added to the global keymap, even before Magit is first used in
the current Emacs session.

If the value is nil, no bindings are added.

If \\+`default', maybe add:

    \\`C-x' \\`g'     `magit-status'
    \\`C-x' \\`M-g'   `magit-dispatch'
    \\`C-c' \\`M-g'   `magit-file-dispatch'

If `recommended', maybe add:

    \\`C-x' \\`g'     `magit-status'
    \\`C-c' \\`g'     `magit-dispatch'
    \\`C-c' \\`f'     `magit-file-dispatch'

    These bindings are strongly recommended, but we cannot use
    them by default, because the \\`C-c <LETTER>' namespace is
    strictly reserved for bindings added by the user.

The bindings in the chosen set may be added when
`after-init-hook' is run.  Each binding is added if, and only
if, at that time no other key is bound to the same command,
and no other command is bound to the same key.  In other words
we try to avoid adding bindings that are unnecessary, as well
as bindings that conflict with other bindings.

Adding these bindings is delayed until `after-init-hook' is
run to allow users to set the variable anywhere in their init
file (without having to make sure to do so before `magit' is
loaded or autoloaded) and to increase the likelihood that all
the potentially conflicting user bindings have already been
added.

To set this variable use either `setq' or the Custom interface.
Do not use the function `customize-set-variable' because doing
that would cause Magit to be loaded immediately, when that form
is evaluated (this differs from `custom-set-variables', which
doesn't load the libraries that define the customized variables).

Setting this variable has no effect if `after-init-hook' has
already been run."
  :package-version '(magit . "4.0.0")
  :group 'magit-essentials
  :type '(choice (const :tag "Add no binding" nil)
                 (const :tag "Use default bindings" default)
                 (const :tag "Use recommended bindings" recommended)))