[Bjonnh.net]# _

Articles / Magit everywhere in Emacs >


category computer tags emacs magit

So I made a keymap, I tried many solutions, the best one comes from Xah on ErgoEmacs.

Now I can for example write this article do s-g s, s-g c, give a useless commit message, s-g P, and the article is online, thanks to the other trick I published recently

  (progn
    ;; define a prefix keymap
    (define-prefix-command 'my-magit-key-map)
    (define-key my-magit-key-map (kbd "s") 'magit-stage-file)
    (define-key my-magit-key-map (kbd "c") 'magit-commit)
    (define-key my-magit-key-map (kbd "S") 'magit-gitflow-feature-start)
    (define-key my-magit-key-map (kbd "F") 'magit-gitflow-feature-finish)
    (define-key my-magit-key-map (kbd "g") 'magit-status)
    (define-key my-magit-key-map (kbd "P") 'magit-push)
    )

  (global-set-key (kbd "s-g") my-magit-key-map)

Related pages: