我们如何自定义 Emacs 的 rgrep 以使用 ripgrep(rg 可执行文件)——使其能够同时使用 Latin 1、UTF-8 和 UTF-16 进行搜索?
这个想法是重用 Emacs 的标准 rgrep 命令,这样我们也可以使用 next-error 和 previous-error...
我不知道如何完全集成(对于基本目录)和(对于匹配的文件)说明符等。
(grep-apply-setting 'grep-find-template
"rg -uu -g <F> <R> <D>")
将产生(在 *.txt 文件中搜索时)
rg -uu -g \( -iname \*.txt \) test .
error: Invalid value for '--max-count <NUM>': invalid digit found in string
Grep exited abnormally with code 1 at Sun Aug 6 00:23:58
最佳答案
grep-find-template
用于将 grep
命令与 find
结合使用。这对我有用:
(grep-apply-setting 'grep-find-template "find <D> <X> -type f <F> -exec rg <C> --no-heading -H <R> /dev/null {} +")
如果您想使用 rg
而不使用 find
,则必须使用 lgrep
并自定义:
(grep-apply-setting 'grep-template "rg --no-heading -H -uu -g <F> <R> <D>")
关于utf-8 - Emacs 中的 Rgrep 使用 ripgrep,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45526670/