Start file searchs from basic sh/dash shell
Uses the most basic, uncustomized shell to a) prevent interference caused by slow shell configs and b) speed up project text searches. This comes at the cost of isolating these programs from envvars that the user may have set in their shell configs in order to change ag/rg/pt/git-grep/grep's behavior. If this bothers you, change +ivy-file-search-shell to your shell (or to the value of `shell-file-name`). Possibly relevant to an issue mentioned in #1260
This commit is contained in:
parent
855ff34e2c
commit
0a7221798b
1 changed files with 16 additions and 1 deletions
|
@ -307,6 +307,20 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
|
||||||
|
|
||||||
(#'counsel-file-jump))))
|
(#'counsel-file-jump))))
|
||||||
|
|
||||||
|
(defvar +ivy-file-search-shell
|
||||||
|
(or (executable-find "dash")
|
||||||
|
(executable-find "sh")
|
||||||
|
shell-file-name)
|
||||||
|
"The SHELL to invoke ag/rg/pt/git-grep/grep searchs from.
|
||||||
|
|
||||||
|
This only affects `+ivy/*' search commands (e.g. `+ivy/rg' and
|
||||||
|
`+ivy/project-search').
|
||||||
|
|
||||||
|
By default, this the most basic, uncustomized shell, to prevent interference
|
||||||
|
caused by slow shell configs at the cost of isolating these programs from
|
||||||
|
envvars that may have been set in the user's shell config to change their
|
||||||
|
behavior. If this bothers you, change this to `shell-file-name'.")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defun +ivy-file-search (engine &key query in all-files (recursive t))
|
(cl-defun +ivy-file-search (engine &key query in all-files (recursive t))
|
||||||
"Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and
|
"Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and
|
||||||
|
@ -359,7 +373,8 @@ order.
|
||||||
((file-relative-name directory project-root))))))
|
((file-relative-name directory project-root))))))
|
||||||
(require 'counsel)
|
(require 'counsel)
|
||||||
(let ((ivy-more-chars-alist
|
(let ((ivy-more-chars-alist
|
||||||
(if query '((t . 1)) ivy-more-chars-alist)))
|
(if query '((t . 1)) ivy-more-chars-alist))
|
||||||
|
(shell-file-name +ivy-file-search-shell))
|
||||||
(pcase engine
|
(pcase engine
|
||||||
(`grep
|
(`grep
|
||||||
(let ((counsel-projectile-grep-initial-input query))
|
(let ((counsel-projectile-grep-initial-input query))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue