From 5385b01243cfdbd05d1708cf4d928664cd1e3047 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 17 Oct 2014 01:01:46 -0400 Subject: Add command magit-show-commit-under-point --- lisp/init-git.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/init-git.el') 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) -- cgit v1.2.3