summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-08-31 23:23:31 -0400
committerKyle Meyer <kyle@kyleam.com>2015-08-31 23:23:31 -0400
commit906b399fcfa931af6f8f5cc7edcf017637f172f8 (patch)
tree3573055decc29b97781ea10ae95a92d157943365
parentea7ee21dacd403dc5035cfbc18ce436ed689596c (diff)
downloademacs.d-906b399fcfa931af6f8f5cc7edcf017637f172f8.tar.gz
Add Magit avy-goto-subword-1 variant
-rw-r--r--lisp/init-git.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index b698b36..4b9b410 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -432,6 +432,14 @@ function."
'km/magit-copy-hook current-prefix-arg))
(magit-copy-as-kill)))
+(defun km/magit-avy-goto-subword-1 ()
+ "Like `km/avy-goto-subword-1', but maybe show commit and limit to window."
+ (interactive)
+ (let (avy-all-windows)
+ (call-interactively #'avy-goto-subword-1))
+ (when (derived-mode-p 'magit-log-mode)
+ (magit-diff-show-or-scroll-up)))
+
(define-key ctl-x-4-map "g" 'magit-find-file-other-window)
(define-key km/file-map "g" 'magit-find-file)
@@ -449,9 +457,9 @@ function."
(define-key magit-file-section-map (kbd "C-j") 'magit-diff-visit-file-worktree)
(define-key magit-hunk-section-map (kbd "C-j") 'magit-diff-visit-file-worktree)
- (define-key magit-log-mode-map "j" 'km/avy-goto-subword-1)
- (define-key magit-refs-mode-map "j" 'km/avy-goto-subword-1)
- (define-key magit-cherry-mode-map "j" 'km/avy-goto-subword-1)
+ (define-key magit-log-mode-map "j" 'km/magit-avy-goto-subword-1)
+ (define-key magit-refs-mode-map "j" 'km/magit-avy-goto-subword-1)
+ (define-key magit-cherry-mode-map "j" 'km/magit-avy-goto-subword-1)
(define-prefix-command 'km/magit-map)
(define-key magit-mode-map "." 'km/magit-map)