Improve better-jumper integration into ivy
And remove unnecessary set-jump on imenu-after-jump-hook (it should happen before the jump, not after).
This commit is contained in:
parent
754dd75624
commit
39d4fa2256
2 changed files with 18 additions and 5 deletions
|
@ -253,11 +253,8 @@ savehist file."
|
||||||
(helpful-variable (button-get button 'apropos-symbol)))))))
|
(helpful-variable (button-get button 'apropos-symbol)))))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! imenu
|
;;;###package imenu
|
||||||
:defer t
|
(add-hook 'imenu-after-jump-hook #'recenter)
|
||||||
:config
|
|
||||||
(add-hook 'imenu-after-jump-hook #'better-jumper-set-jump)
|
|
||||||
(add-hook 'imenu-after-jump-hook #'recenter))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! smartparens
|
(def-package! smartparens
|
||||||
|
|
|
@ -62,6 +62,22 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
;; enable ability to select prompt (alternative to `ivy-immediate-done')
|
;; enable ability to select prompt (alternative to `ivy-immediate-done')
|
||||||
ivy-use-selectable-prompt t)
|
ivy-use-selectable-prompt t)
|
||||||
|
|
||||||
|
;; Ensure a jump point is registered before jumping to new locations with ivy
|
||||||
|
(defvar +ivy--origin nil)
|
||||||
|
|
||||||
|
(defun +ivy|record-position-maybe ()
|
||||||
|
(with-ivy-window
|
||||||
|
(setq +ivy--origin (point-marker))))
|
||||||
|
(setq ivy-hooks-alist '((t . +ivy|record-position-maybe)))
|
||||||
|
|
||||||
|
(defun +ivy|set-jump-point-maybe ()
|
||||||
|
(when (and (markerp +ivy--origin)
|
||||||
|
(not (equal (with-ivy-window (point-marker)) +ivy--origin)))
|
||||||
|
(with-current-buffer (marker-buffer +ivy--origin)
|
||||||
|
(better-jumper-set-jump +ivy--origin)))
|
||||||
|
(setq +ivy--origin nil))
|
||||||
|
(add-hook 'minibuffer-exit-hook #'+ivy|set-jump-point-maybe)
|
||||||
|
|
||||||
(after! yasnippet
|
(after! yasnippet
|
||||||
(add-to-list 'yas-prompt-functions #'+ivy-yas-prompt nil #'eq))
|
(add-to-list 'yas-prompt-functions #'+ivy-yas-prompt nil #'eq))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue