Previous: , Up: Essential Settings   [Contents][Index]


9.2.3 Global Bindings

User Option: magit-define-global-key-bindings

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 gmagit-status
    C-x M-gmagit-dispatch
    C-c M-gmagit-file-dispatch
  • If recommended, maybe add:
    C-x gmagit-status
    C-c gmagit-dispatch
    C-c fmagit-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 (see (elisp)Key Binding Conventions).

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.


Previous: Performance, Up: Essential Settings   [Contents][Index]