feat(defaults): use ripgrep (rg) for 'grepprg' if available

This commit is contained in:
Luna Saphie Mittelbach
2024-04-14 12:54:10 +02:00
committed by Christian Clason
parent fe4583127f
commit 20b38677c2
7 changed files with 62 additions and 4 deletions

View File

@@ -496,3 +496,11 @@ if tty then
end
end
end
--- 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')
vim.o.grepformat = '%f:%l:%c:%m'
end