|Tip 110||Customize the grep Program|
Vim’s :grep command is a wrapper for the external grep program. We can customize the way that Vim delegates this task by manipulating two settings: ‘grepprg’ and ‘grepformat’. First we’ll examine the defaults, and then we’ll see how tweaking them allows us to outsource the search task to any other suitable program.
Vim’s Default grep Settings
The ‘grepprg’ setting specifies what to run in the shell when Vim’s :grep command is executed ('grepprg'ⓘ). The ‘grepformat’ setting tells Vim how to parse the output returned by the :grep command (see 'grepformat'ⓘ). On Unix systems, the defaults are these:
|||grepprg="grep -n $* /dev/null"|
The $* symbol used in the ‘grepprg’ ...