completion/ivy: refactor ag/rg/pt/git-grep advice functions

They are no isolated to their evil use cases.
This commit is contained in:
Henrik Lissner 2018-03-18 22:00:14 -04:00
parent ff2f30f9b4
commit 8d72257aa6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 74 additions and 56 deletions

View file

@ -155,23 +155,6 @@ search current file. See `+ivy-task-tags' to customize what this searches for."
:action #'+ivy--tasks-open-action
:caller '+ivy/tasks))
;;;###autoload
(defun +ivy*counsel-ag-function (string)
"Advice to get rid of the character limit from `counsel-ag-function' and use
`evil-set-jump' if evil is active.
NOTE This may need to be updated frequently, to meet changes upstream (in
counsel-rg)."
(if (< (length string) 1) ; <-- modified the character limit
(counsel-more-chars 1) ; <--
(let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel-unquote-regex-parens
(setq ivy--old-re
(ivy--regex string)))))
(counsel--async-command (format counsel-ag-command
(shell-quote-argument regex)))
nil)))
;;;###autoload
(defun +ivy/wgrep-occur ()
"Invoke the search+replace wgrep buffer on the current ag/rg search results."