Configuration - Sfate/grep.vim GitHub Wiki

By changing the following variables you can configure the behavior of this plugin. Set the following variables in your .vimrc file using the 'let' command.

The 'Grep_Path' variable is used to locate the grep utility. By default, this is set to grep. You can change this using the let command:

  :let Grep_Path = 'd:\tools\grep.exe'

The 'Fgrep_Path' variable is used to locate the fgrep utility. By default, this is set to fgrep. You can change this using the let command:

  :let Fgrep_Path = 'd:\tools\fgrep.exe'

The 'Egrep_Path' variable is used to locate the egrep utility. By default, this is set to egrep. You can change this using the let command:

  :let Egrep_Path = 'd:\tools\egrep.exe'

The 'Agrep_Path' variable is used to locate the agrep utility. By default, this is set to agrep. You can change this using the let command:

  :let Agrep_Path = 'd:\tools\agrep.exe'

The 'Grep_Find_Path' variable is used to locate the find utility. By default, this is set to d:\tools\find.exe. You can change this using the let command:

  :let Grep_Find_Path = 'd:\tools\find.exe'

The 'Grep_Xargs_Path' variable is used to locate the xargs utility. By default, this is set to xargs. You can change this using the let command:

  :let Grep_Xargs_Path = 'd:\tools\xargs.exe'

The 'Ack_Path' variable is used to locate the ack utility. By default, this is set to ack. You can change this using the let command:

  :let Grep_Xargs_Path = 'ack-grep'

When running any one of the Grep commands, you will be prompted for the files in which to search for the pattern. The 'Grep_Default_Filelist' variable is used to specify to default for this prompt. By default, this variable is set to '*'. You can specify multiple matching patterns separated by spaces. You can change this settings using the let command:

  :let Grep_Default_Filelist = '*.[chS]'
  :let Grep_Default_Filelist = '*.c *.cpp *.asm'

The 'Grep_Default_Options' is used to pass default command line options to the grep/fgrep/egrep/agrep utilities. By default, this is set to an empty string. You can change this using the let command:

  :let Grep_Default_Options = '-i'

The 'Grep_Skip_Dirs' variable specifies the list of directories to skip while doing recursive searches. By default, this is set to 'RCS CVS SCCS'. You can change this using the let command:

  :let Grep_Skip_Dirs = 'dir1 dir2 dir3'

The 'Grep_Skip_Files' variable specifies the list of files to skip while doing recursive searches. By default, this is set to '*~ ,v s.'. You can change this using the let command:

  :let Grep_Skip_Files = '*.bak *~'

By default, when you invoke the Grep commands the quickfix window will be opened with the grep output. You can disable opening the quickfix window, by setting the 'Grep_OpenQuickfixWindow' variable to zero:

  :let Grep_OpenQuickfixWindow = 0

By default, when you invoke the Grep commands the quickfix window will be
opened with the grep output. You can enable opening the quickfix window
in new tab, by setting the 'Grep_OpenTabWithQuickfixWindow' variable to
one:

   :let Grep_OpenTabWithQuickfixWindow = 1 

You can manually open the quickfix window using the :cwindow command.

By default, for recursive searches, the 'find' and 'xargs' utilities are used. If you don't have the 'xargs' utility or don't want to use the 'xargs' utility, " then you can set the 'Grep_Find_Use_Xargs' variable to zero. If this is set to zero, then only the 'find' utility is used for recursive searches:

  :let Grep_Find_Use_Xargs = 0

To handle file names with space characters in them, the xargs utility is invoked with the '--null' argument. If the xargs utility in your system doesn't accept the '--null' argument, then you can change the Grep_Xargs_Options variable. For example, to use the '--print0' xargs argument, you can use the following command:

:let Grep_Xargs_Options = '--print0'

The Grep_Cygwin_Find variable should be set to 1, if you are using the find utility from the cygwin package. This setting is used to handle the difference between the backslash and forward slash path separators.

  :let Grep_Cygwin_Find = 1

The 'Grep_Null_Device' variable specifies the name of the null device to pass to the grep commands. This is needed to force the grep commands to print the name of the file in which a match is found, if only one filename is specified. For Unix systems, this is set to /dev/null and for MS-Windows systems, this is set to NUL. You can modify this by using the let command:

  :let Grep_Null_Device = '/dev/null'

The 'Grep_Shell_Quote_Char' variable specifies the quote character to use for protecting patterns from being interpreted by the shell. For Unix systems, this is set to "'" and for MS-Window systems, this is set to an empty string. You can change this using the let command:

  :let Grep_Shell_Quote_Char = "'"

The 'Grep_Shell_Escape_Char' variable specifies the escape character to use for protecting special characters from being interpreted by the shell. For Unix systems, this is set to '&#039 and for MS-Window systems, this is set to an empty string. You can change this using the let command:

  :let Grep_Shell_Escape_Char = "'"

Back to overview