aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuna Saphie Mittelbach <lunarlambda@gmail.com>2024-04-28 18:00:48 +0200
committerGitHub <noreply@github.com>2024-04-28 09:00:48 -0700
commit513fc461957f370f9e89b3cfd56cb03a816d6941 (patch)
tree03098d5684503e0a5a145a63a69d2c0956aca7e5 /src
parent83635e4e3db9a99c128e84e79deb590da354215d (diff)
downloadrneovim-513fc461957f370f9e89b3cfd56cb03a816d6941.tar.gz
rneovim-513fc461957f370f9e89b3cfd56cb03a816d6941.tar.bz2
rneovim-513fc461957f370f9e89b3cfd56cb03a816d6941.zip
feat(defaults): improve :grep defaults #28545
Based on feedback from #28324, pass -H and -I to regular grep (available on all platforms officially supported by Neovim), and only pass -uu to ripgrep. This makes :grep ignore binary files by default in both cases.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/options.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index c22bce04c8..d4aceed013 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -3382,7 +3382,7 @@ return {
abbreviation = 'gp',
defaults = {
condition = 'MSWIN',
- if_false = 'grep -n $* /dev/null',
+ if_false = 'grep -HIn $* /dev/null',
if_true = 'findstr /n $* nul',
doc = [[see below]],
},
@@ -3392,10 +3392,7 @@ return {
line. The placeholder "$*" is allowed to specify where the arguments
will be included. Environment variables are expanded |:set_env|. See
|option-backslash| about including spaces and backslashes.
- When your "grep" accepts the "-H" argument, use this to make ":grep"
- also work well with a single file: >vim
- set grepprg=grep\ -nH
- < Special value: When 'grepprg' is set to "internal" the |:grep| command
+ Special value: When 'grepprg' is set to "internal" the |:grep| command
works like |:vimgrep|, |:lgrep| like |:lvimgrep|, |:grepadd| like
|:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|.
See also the section |:make_makeprg|, since most of the comments there
@@ -3403,11 +3400,11 @@ return {
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
This option defaults to:
- - `rg --vimgrep -uuu $* ...` if ripgrep is available (|:checkhealth|),
- - `grep -n $* /dev/null` on Unix,
+ - `rg --vimgrep -uu ` if ripgrep is available (|:checkhealth|),
+ - `grep -HIn $* /dev/null` on Unix,
- `findstr /n $* nul` on Windows.
Ripgrep can perform additional filtering such as using .gitignore rules
- and skipping hidden or binary files. This is disabled by default (see the -u option)
+ and skipping hidden files. This is disabled by default (see the -u option)
to more closely match the behaviour of standard grep.
You can make ripgrep match Vim's case handling using the
-i/--ignore-case and -S/--smart-case options.