summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-08-02 01:38:29 -0400
committerKyle Meyer <kyle@kyleam.com>2015-08-02 23:18:31 -0400
commit9ab3cf0c5d2f1f1023802ee3e9fea7b885565530 (patch)
treed61cd5cc554ec0d1ca55d1cab22ee5ca8d6031a5
parentc21837be1c370684bc4e6f747c6241e77d0e4550 (diff)
downloademacs.d-9ab3cf0c5d2f1f1023802ee3e9fea7b885565530.tar.gz
Add magit-find-recently-changed-file command
-rw-r--r--lisp/init-git.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 2f8c5ca..a3375b1 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -266,6 +266,17 @@ If checkout is non-nil, checkout file instead."
(magit-run-git (if checkout "checkout" "reset")
magit-buffer-refname "--" magit-buffer-file-name)))
+(defun km/magit-find-recently-changed-file (n)
+ "Find a file that changed from \"HEAD~N..HEAD\".
+N defaults to 20."
+ (interactive "p")
+ (unless current-prefix-arg (setq n 10))
+ (magit-with-toplevel
+ (find-file (magit-completing-read
+ "File"
+ (magit-changed-files (format "HEAD~%s..HEAD" n))
+ nil t))))
+
(defun km/magit-insert-staged-file (&optional no-directory)
"Select staged file to insert.
@@ -430,6 +441,7 @@ function."
(define-key km/git-map "n" 'km/magit-shorten-hash-at-point)
(define-key km/git-map "l" 'magit-log-buffer-file)
(define-key km/git-map "p" 'km/magit-pin-file)
+ (define-key km/git-map "r" 'km/magit-find-recently-changed-file)
(define-key km/git-map "s" 'km/magit-insert-staged-file)
(define-key km/git-map "u" 'km/magit-auto-commit)
(define-key km/git-map "v" 'km/magit-revfile-reset))