[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function
From: |
Oleh Krehel |
Subject: |
[elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function): Add |
Date: |
Sat, 20 Jul 2019 14:57:16 -0400 (EDT) |
branch: master
commit 44ea8b5edf7115269db21987ba812bb68e4b078b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git-grep-cmd-function): Add
Fixes #2011
---
counsel.el | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/counsel.el b/counsel.el
index e1a733c..a883c7e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1286,13 +1286,31 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
Typical value: '(recenter)."
:type 'hook)
+(defcustom counsel-git-grep-cmd-function
#'counsel-git-grep-cmd-function-default
+ "How a git-grep shell call is built from the input."
+ :type '(radio
+ (function-item counsel-git-grep-cmd-function-default)
+ (function-item counsel-git-grep-cmd-function-ignore-order)
+ (function :tag "Other")))
+
+(defun counsel-git-grep-cmd-function-default (str)
+ (format counsel-git-grep-cmd
+ (setq ivy--old-re (ivy--regex str t))))
+
+(defun counsel-git-grep-cmd-function-ignore-order (str)
+ (setq ivy--old-re (ivy--regex str t))
+ (let ((parts (split-string str " " t)))
+ (concat
+ "git --no-pager grep --full-name -n --no-color -i -e "
+ (mapconcat #'shell-quote-argument parts " --and -e "))))
+
(defun counsel-git-grep-function (string)
"Grep in the current Git repository for STRING."
(or
(ivy-more-chars)
- (let ((cmd (format counsel-git-grep-cmd
- (setq ivy--old-re (ivy--regex string t)))))
- (counsel--async-command cmd)
+ (progn
+ (counsel--async-command
+ (funcall counsel-git-grep-cmd-function string))
nil)))
(defun counsel-git-grep-action (x)
- [elpa] master 11b0007 158/399: swiper.el (swiper--action): Simplify, (continued)
- [elpa] master 11b0007 158/399: swiper.el (swiper--action): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 1ebbb5f 136/399: swiper.el (swiper-isearch): Set swiper-min-highlight to 1, Oleh Krehel, 2019/07/20
- [elpa] master b34bf45 140/399: counsel.el (counsel-dired): Add, Oleh Krehel, 2019/07/20
- [elpa] master 1e38ed4 146/399: counsel.el (counsel-minor): Add command to toggle minor mode, Oleh Krehel, 2019/07/20
- [elpa] master 2098d27 148/399: swiper.el: Set up occur for swiper-isearch, Oleh Krehel, 2019/07/20
- [elpa] master dceecd8 155/399: swiper.el (swiper-occur): Adapt to swiper-isearch, Oleh Krehel, 2019/07/20
- [elpa] master f38bb51 161/399: ivy.el (ivy--prompt-selectable-p): Allow to select "", Oleh Krehel, 2019/07/20
- [elpa] master 1b13ee8 162/399: ivy.el (ivy--use-selectable-prompt): Cache ivy--prompt-selected-p, Oleh Krehel, 2019/07/20
- [elpa] master 92ec03c 163/399: ivy-test.el (ivy-use-selectable-prompt): Add tests, Oleh Krehel, 2019/07/20
- [elpa] master b2693d1 160/399: counsel.el (counsel-locate-db-path): New defcustom, Oleh Krehel, 2019/07/20
- [elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function): Add,
Oleh Krehel <=
- [elpa] master 502eae6 159/399: counsel.el (counsel--call): Rename to counsel--command, Oleh Krehel, 2019/07/20
- [elpa] master 115efb7 170/399: ivy.el (ivy--sorted-files): Work around all-completions returning $$, Oleh Krehel, 2019/07/20
- [elpa] master 6c858c1 168/399: ivy.el (ivy--filter): Improve performance with :matcher, Oleh Krehel, 2019/07/20
- [elpa] master ba849e5 173/399: ivy.el (ivy--re-filter): Fix for ivy--regex-ignore-order, Oleh Krehel, 2019/07/20
- [elpa] master 5458f93 169/399: ivy.el (ivy--filter): Avoid a filter on empty input, Oleh Krehel, 2019/07/20
- [elpa] master 9c53320 174/399: swiper.el (swiper-isearch-function): Fix for strings with trailing \|, Oleh Krehel, 2019/07/20
- [elpa] master ce0a1f1 172/399: ivy.el (ivy--filter): Fix matcher not called on input "", Oleh Krehel, 2019/07/20
- [elpa] master 39759cf 180/399: ivy-test.el (ivy-with): Save current buffer, Oleh Krehel, 2019/07/20
- [elpa] master fa87b97 182/399: ivy-test.el: Print version, Oleh Krehel, 2019/07/20
- [elpa] master 8482f62 179/399: swiper.el (swiper-isearch-function): Fix str is " ", Oleh Krehel, 2019/07/20