summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-10-17 01:01:46 -0400
committerKyle Meyer <kyle@kyleam.com>2014-10-17 01:01:46 -0400
commit5385b01243cfdbd05d1708cf4d928664cd1e3047 (patch)
tree7b709aa92a6924df22533590120154c8288516cd
parent92d24094a9a20c24d39dfed402a1188a8d043816 (diff)
downloademacs.d-5385b01243cfdbd05d1708cf4d928664cd1e3047.tar.gz
Add command magit-show-commit-under-point
-rw-r--r--lisp/init-git.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 40ff2a3..b2c03e4 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -25,6 +25,13 @@ Useful for non-source code repos (e.g., Org mode note files)."
(interactive)
(magit-run-git "commit" "--all" "--message=auto"))
+(defun km/magit-show-commit-under-point ()
+ "Pass text at point as commit to `magit-show-commit'.
+This is useful for commit IDs in files and log messages."
+ (interactive)
+ (--when-let (thing-at-point 'word)
+ (magit-show-commit it)))
+
(defun km/magit-push-all ()
"Push all branches."
(interactive)
@@ -133,6 +140,7 @@ START-POINT set to the current branch.
(define-prefix-command 'km/git-map)
(global-set-key (kbd "C-c g") 'km/git-map)
+(define-key km/git-map "c" 'km/magit-show-commit-under-point)
(define-key km/git-map "u" 'km/magit-auto-commit)