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.
This commit is contained in:
Luna Saphie Mittelbach
2024-04-28 18:00:48 +02:00
committed by GitHub
parent 83635e4e3d
commit 513fc46195
6 changed files with 19 additions and 30 deletions

View File

@@ -560,9 +560,8 @@ end
do
--- Default 'grepprg' to ripgrep if available.
if vim.fn.executable('rg') == 1 then
-- Match :grep default, otherwise rg searches cwd by default
-- Use -uuu to make ripgrep not do its default filtering
vim.o.grepprg = 'rg --vimgrep -uuu $* ' .. (vim.fn.has('unix') == 1 and '/dev/null' or 'nul')
-- Use -uu to make ripgrep not check ignore files/skip dot-files
vim.o.grepprg = 'rg --vimgrep -uu '
vim.o.grepformat = '%f:%l:%c:%m'
end
end