Set evil jump point before counsel-ag (and variants)

This commit is contained in:
Henrik Lissner 2018-03-18 15:18:19 -04:00
parent ff0b45299e
commit bf771dcbdb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 6 additions and 4 deletions

View file

@ -157,14 +157,15 @@ search current file. See `+ivy-task-tags' to customize what this searches for."
;;;###autoload ;;;###autoload
(defun +ivy*counsel-ag-function (string) (defun +ivy*counsel-ag-function (string)
"Advice to 1) get rid of the character limit from `counsel-ag-function' and 2) "Advice to get rid of the character limit from `counsel-ag-function' and use
disable ivy's over-zealous parentheses quoting behavior (if i want literal `evil-set-jump' if evil is active.
parentheses, I'll escape them myself).
NOTE This may need to be updated frequently, to meet changes upstream (in NOTE This may need to be updated frequently, to meet changes upstream (in
counsel-rg)." counsel-rg)."
(if (< (length string) 1) ; <-- modified the character limit (if (< (length string) 1) ; <-- modified the character limit
(counsel-more-chars 1) ; <-- (counsel-more-chars 1) ; <--
(when (and (featurep 'evil) evil-mode)
(evil-set-jump))
(let ((default-directory (ivy-state-directory ivy-last)) (let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel-unquote-regex-parens (regex (counsel-unquote-regex-parens
(setq ivy--old-re (setq ivy--old-re

View file

@ -109,7 +109,8 @@ immediately runs it on the current candidate (ending the ivy session)."
cmd cmd
'(("O" +ivy-git-grep-other-window-action "open in other window")))) '(("O" +ivy-git-grep-other-window-action "open in other window"))))
;; Removes character limit from `counsel-ag-function' ;; Removes character limit from `counsel-ag-function' and sets a jump point
;; for `evil'.
;; ;;
;; This may need to be updated frequently, to meet changes upstream. ;; This may need to be updated frequently, to meet changes upstream.
;; counsel-ag, counsel-rg and counsel-pt all use this function ;; counsel-ag, counsel-rg and counsel-pt all use this function