From 906b399fcfa931af6f8f5cc7edcf017637f172f8 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 31 Aug 2015 23:23:31 -0400 Subject: Add Magit avy-goto-subword-1 variant --- lisp/init-git.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lisp/init-git.el') 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) -- cgit v1.2.3