Function: git-rebase-mode-show-keybindings

git-rebase-mode-show-keybindings is a byte-compiled function defined in git-rebase.el.

Signature

(git-rebase-mode-show-keybindings)

Documentation

Modify the "Commands:" section of the comment Git generates.

Modify that section to replace Git's one-letter command abbreviation, with the key bindings used in Magit. By default, these are the same, except for the "pick" command.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/git-rebase.el
(defun git-rebase-mode-show-keybindings ()
  "Modify the \"Commands:\" section of the comment Git generates.
Modify that section to replace Git's one-letter command abbreviation,
with the key bindings used in Magit.  By default, these are the same,
except for the \"pick\" command."
  (let ((inhibit-read-only t))
    (save-excursion
      (goto-char (point-min))
      (when (and git-rebase-show-instructions
                 (re-search-forward
                  (concat git-rebase-comment-re "\\s-+p, pick")
                  nil t))
        (goto-char (line-beginning-position))
        (git-rebase--insert-descriptions git-rebase-command-descriptions)
        (let ((cmd nil)
              (line (concat git-rebase-comment-re "\\(?:\\( \\.?     *\\)\\|"
                            "\\( +\\)\\([^\n,],\\) \\([^\n ]+\\) \\)")))
          (while (re-search-forward line nil t)
            (if (match-str 1)
                (if (assq cmd git-rebase-fixup-descriptions)
                    (delete-line)
                  (replace-match (make-string 10 ?\s) t t nil 1))
              (setq cmd (intern (concat "git-rebase-" (match-str 4))))
              (cond
                ((not (fboundp cmd))
                 (delete-line))
                ((eq cmd 'git-rebase-fixup)
                 (delete-line)
                 (git-rebase--insert-descriptions git-rebase-fixup-descriptions))
                (t
                 (add-text-properties (line-beginning-position)
                                      (1+ (line-end-position))
                                      '(font-lock-face font-lock-comment-face))
                 (replace-match " " t t nil 2)
                 (replace-match
                  (string-pad
                   (save-match-data
                     (substitute-command-keys (format "\\[%s]" cmd)))
                   8)
                  t t nil 3))))))))))