sponsor Vim development Vim logo Vim Book Ad

grep.vim : Search tools (grep, ripgrep, ack, ag, findstr, git grep) integration with Vim

 script karma  Rating 1055/355, Downloaded by 51388  Comments, bugs, improvements  Vim wiki

created by
Yegappan Lakshmanan
 
script type
utility
 
description
The grep plugin integrates grep like utilities (grep, fgrep, egrep, agrep, findstr, silver searcher, ack, ripgrep, git grep, sift, platinum searcher and universal code grep) with Vim and allows you to search for a pattern in one or more files and jump to them.

To use this plugin, you will need the grep like utilities in your system.  If a particular utility is not present, then you cannot use the corresponding features, but you can still use the rest of the features supported by the plugin.  For information about where to download these utilities, refer to the help file.

The github repository for this plugin is at https://github.com/yegappan/grep

The grep.vim plugin introduce the following Vim commands - :Grep, :Rgrep, :GrepBuffer, :GrepArgs, :Fgrep, :Egrep, :Findstr, :Agrep, :Ag, :Ack, :Rg, :GitGrep, :Sift, :Ptgrep, :Ucgrep, etc.  You can use these commands to search for patterns.

For more information about the commands and how to configure this plugin, refer to the help file.
 
install details
You can use any one of the Vim plugin managers (dein.vim, pathogen, vam, vim-plug, volt, Vundle, etc.) to install and manage this plugin.

Alternatively, you can also manually download and install the plugin using the following steps.

1. Download the grep.zip file from the https://vim.sourceforge.io site.
2. Expand the grep.zip file to the $HOME/.vim/plugin or $HOME/vimfiles/plugin or $VIM/vimfiles/plugin directory.
3. If the grep executables are not already present in one of the directories in the PATH environment variable, then set the Grep_Path and other _Path variables to point to the location of the grep utilities in the .vimrc file.
4. Restart Vim.
5. You can now use the ":Grep" and other commands to search for patterns in files.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
grep.zip 2.2 2018-05-29 7.0 Yegappan Lakshmanan Added support for Universal Code Grep (UCG).
grep.zip 2.1 2018-04-21 7.0 Yegappan Lakshmanan 1. Added support for git grep, sift, platinum searcher and findstr.
2. Removed Grep_Default_Options and added support for search command specific option variables.
3. Use 'shell' and 'shellcmdflag' options for running the search command.
4. Redirect the search command input to null.
5. On MS-Windows, convert the command path, search directory path, and temporary file path to 8.3 format.
6. Support for running commands like ag, ack, ripgrep, git and platinum searcher without any file names to support recursive searches.
7. Move all the commands and their options into a separate table for simplified lookup.
8. On MS-Windows, use findstr instead of grep for buffer list and argument list search commands.
9. Refactor the code and simplify long functions.
10. Changed the license to MIT license.
grep.zip 2.0 2018-02-05 7.0 Yegappan Lakshmanan 1. Added support for running the grep commands asynchronously (needs Vim version 8.0 and above).
2. Added support for the silver searcher (ag), ripgrep and ack tools.
3. Support for updating the correct quickfix list (if the quickfix identifier support is present).
4. Escape the program path to handle space characters in program name.
5. Convert the plugin into an autoloaded plugin.
6. Move the documentation to a help file.
grep.vim 1.11 2013-04-28 6.0 Yegappan Lakshmanan Fixed a problem in using the "Rgrep <pattern> <filenames>" command.
grep.vim 1.10 2013-04-24 6.0 Yegappan Lakshmanan Fix the problem in running the grep command in MS-Windows because of command-line
quoting issues.
grep.vim 1.9 2007-09-10 6.0 Yegappan Lakshmanan New commands to add search results to the existing results.  New
Grep_Xargs_Options variable to control the options passed to xargs.
Don't echo newlines before running the commands.
grep.vim 1.8 2007-03-13 6.0 Yegappan Lakshmanan Support for expanding file and directory names in the search prompt. Fix for recursively searching for filenames with space characters in the name using find and xargs.
grep.vim 1.7 2006-06-16 6.0 Yegappan Lakshmanan Added filename completion support for grep commands. In GUI Vim, added Tools->Search menu item for using the Grep commands.
grep.vim 1.6 2005-08-10 6.0 Yegappan Lakshmanan 1. Add the search pattern to the search results.
2. Support for the -h argument to the commands.
3. Make the plugin work in Vi-compatible mode.
4. Updated documentation.
grep.vim 1.5 2005-04-28 6.0 Yegappan Lakshmanan Don't automatically jump to the first match in the grep output.
grep.vim 1.4 2004-10-27 6.0 Yegappan Lakshmanan Support for specifying the grep flags, search pattern and filenames as argument to commands and other minor improvements.
grep.vim 1.3 2002-06-11 6.0 Yegappan Lakshmanan Fixed file pattern quoting and special character escaping for MS-Windows.
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github