diff --git a/lisp/init-magit.el b/lisp/init-magit.el index 50df39c..524ddf4 100644 --- a/lisp/init-magit.el +++ b/lisp/init-magit.el @@ -1,6 +1,32 @@ ;; *** Magit -;; TODO: add blamer.el (https://github.com/Artawower/blamer.el), currently fails to install (2023/05/08) + +(when (fboundp 'defhydra) + (defhydra hydra-blame (:timeout 30.0 :exit nil) + " +^Blame Mode^ +^^-------------------------------------------------------------- +_n_: next chunk _M-w_: copy commit hash hash +_p_: prev chunk _c_: cycle style +_N_: next chunk same commit _RET_: show current commit +_P_: prev chunk same commit _q_: quit blame mode + +^^-------------------------------------------------------------- +Reach this hydra with , magit-blame mode must be active +^^-------------------------------------------------------------- + +" + + ("n" magit-blame-next-chunk nil) + ("p" magit-blame-previous-chunk nil) + ("N" magit-blame-next-chunk-same-commit nil) + ("P" magit-blame-previous-chunk-same-commit nil) + ("M-w" magit-blame-copy-hash nil) + ("RET" magit-show-commit nil) + ("c" magit-blame-cycle-style nil) + ("q" nil nil :color blue)) + + (global-set-key (kbd "C-x B") 'hydra-blame/body)) ;; Not much to say about Magit (use-package magit @@ -16,11 +42,12 @@ (("C-c g" . magit-file-dispatch)) :hook - ;; automatically fire up smerge hydra when visiting a buffer ;; containing merge conflict[s]. Hydra see init-ediff.el - (magit-diff-visit-file . (lambda () - (hydra-smerge/body))) + (magit-diff-visit-file . (lambda () (hydra-smerge/body))) + + // automatically fire up blame hydra, see definition above ont top + (magit-blame-mode . (lambda () (hydra-blame/body))) :config (magit-todos-mode)