aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Nicolai <dalanicolai@gmail.com>2020-07-10 11:47:25 +0200
committerGitHub <noreply@github.com>2020-07-10 12:47:25 +0300
commitbbcf781d3fddb8e00d0dc10eb68bc2528fb409b3 (patch)
treee2166ceadc8c09394b40c3de5df800fdbfdc218f
parent40df970f662deb48106757611906c837273dc510 (diff)
Add ripgrep search option (#1555)
Added as first option, like in [spacemacs](https://develop.spacemacs.org/doc/DOCUMENTATION.html#searching) and [visual studio code](https://code.visualstudio.com/updates/v1_11#_text-search-improvements).
-rw-r--r--CHANGELOG.md1
-rw-r--r--projectile.el9
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c8acac..407c783 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
* [#1539](https://github.com/bbatsov/projectile/pull/1539): New defcustom `projectile-auto-discover` controlling whether to automatically discover projects in the search path when `projectile-mode` activates.
* Add [emacs-eldev](https://github.com/doublep/eldev) project type.
* Add Dart project type.
+* [#1555](https://github.com/bbatsov/projectile/pull/1555) Add search with ripgrep.
### Changes
diff --git a/projectile.el b/projectile.el
index aec9ff7..b68bab9 100644
--- a/projectile.el
+++ b/projectile.el
@@ -3581,13 +3581,16 @@ Returns a list of expanded filenames."
(defun projectile-files-with-string (string directory)
"Return a list of all files containing STRING in DIRECTORY.
-Tries to use ag, ack, git-grep, and grep in that order. If those
+Tries to use rg, ag, ack, git-grep, and grep in that order. If those
are impossible (for instance on Windows), returns a list of all
files in the project."
(if (projectile-unixy-system-p)
(let* ((search-term (shell-quote-argument string))
- (cmd (cond ((executable-find "ag")
- (concat "ag --literal --nocolor --noheading -l -- "
+ (cmd (cond ((executable-find "rg")
+ (concat "rg -lF --no-heading --color never -- "
+ search-term))
+ ((executable-find "ag")
+ (concat "ag --literal --nocolor --noheading -l -- "
search-term))
((executable-find "ack")
(concat "ack --literal --noheading --nocolor -l -- "