Fix evil jumplist after jumping to ag match
helm-ag would formerly add multiple entries to the jump list. It now only adds one, and recenters the window when jumping to an ag match.
This commit is contained in:
parent
b149dcffd4
commit
5714ff423a
3 changed files with 14 additions and 5 deletions
|
@ -120,3 +120,7 @@ to a new one."
|
|||
(when (fboundp 'powerline-reset)
|
||||
(powerline-reset)))
|
||||
(error "Problem loading theme %s" x)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom*recenter (&rest _)
|
||||
(recenter))
|
||||
|
|
|
@ -150,7 +150,9 @@ be negative.")
|
|||
(after! helm-ag
|
||||
(map! :map helm-ag-edit-map :n "RET" #'compile-goto-error)
|
||||
(define-key helm-ag-edit-map [remap quit-window] #'helm-ag--edit-abort)
|
||||
(set-popup-rule! "^\\*helm-ag-edit" :size 0.35 :ttl 0 :quit nil))
|
||||
(set-popup-rule! "^\\*helm-ag-edit" :size 0.35 :ttl 0 :quit nil)
|
||||
;; Recenter after jumping to match
|
||||
(advice-add #'helm-ag--find-file-action :after-while #'doom*recenter))
|
||||
|
||||
|
||||
;; `helm-bookmark'
|
||||
|
|
|
@ -114,10 +114,13 @@
|
|||
(advice-add #'evil-window-split :override #'+evil*window-split)
|
||||
(advice-add #'evil-window-vsplit :override #'+evil*window-vsplit)
|
||||
|
||||
;; Ensure jump points are created
|
||||
(defun +evil*set-jump (&rest _)
|
||||
(evil-set-jump))
|
||||
(advice-add #'counsel-git-grep-action :before #'+evil*set-jump)
|
||||
(defun +evil*set-jump (orig-fn &rest args)
|
||||
"Set a jump point and ensure ORIG-FN doesn't set any new jump points."
|
||||
(evil-set-jump)
|
||||
(let ((evil--jumps-jumping t))
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'counsel-git-grep-action :around #'+evil*set-jump)
|
||||
(advice-add #'helm-ag--find-file-action :around #'+evil*set-jump)
|
||||
|
||||
;; --- custom interactive codes -----------
|
||||
;; These arg types will highlight matches in the current buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue