How do I use an external grep program from within Vim?
Answer
:grep pattern files
Explanation
The :grep command runs an external grep tool and loads the results into Vim's quickfix list. It is faster than :vimgrep for large codebases.
How it works
:grep pattern filesruns the program specified bygrepprg- Results are parsed and loaded into the quickfix list
:copenopens the quickfix window to browse matches
Example
:grep -r "TODO" src/
:copen
:cnext
Tips
:set grepprg=rg\ --vimgrepuses ripgrep for faster searching:set grepformat=%f:%l:%c:%msets the output format parser:lgrepuses the location list instead of quickfix:grep!suppresses the automatic jump to the first match