sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

GrepCommands : Perform :vimgrep over arguments, buffers, windows.

 script karma  Rating 2/2, Downloaded by 519    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
This plugin defines variants of the built-in :vimgrep command which target
all arguments, listed buffers, windows in the current tab page or all tab
pages for its search. Additionally, the search defaults to the last search
pattern, so using these commands is often much faster than building the
equivalent search with :vimgrep.

- The GrepHere plugin (vimscript #4191) provides a :GrepHere command that
  covers only the current buffer.

- This is a modern re-implementation of the similar commands defined by
  greputils.vim (vimscript #1062), which hasn't been updated since 2005.
- brep (vimscript #3653) can grep buffers (also unlisted with [!]) and show
  them in the quickfix list.
- greplace (vimscript #1813) can search buffers and arguments; it shows the
  matches in a special replace buffer that can be edited and incorporated into
  the original files.

:ArgGrep[Add][!] [{pattern}]
:ArgGrep[Add][!] /{pattern}/[g][j]
                        Search for {pattern} (or last search pattern if
                        omitted) in all files from the argument-list and set
                        the error list to the matches.
                        Same as :vimgrep {pattern} ##.

:BufGrep[Add][!] [{pattern}]
:BufGrep[Add][!] /{pattern}/[g][j]
                        Search for {pattern} (or last search pattern if
                        omitted) in all listed buffers and set the error list
                        to the matches.

:WinGrep[Add][!] [{pattern}]
:WinGrep[Add][!] /{pattern}/[g][j]
                        Search for {pattern} (or last search pattern if
                        omitted) in all buffers visible in the current tab
                        page and set the error list to the matches.

:TabGrep[Add][!] [{pattern}]
:TabGrep[Add][!] /{pattern}/[g][j]
                        Search for {pattern} (or last search pattern if
                        omitted) in all buffers visible in all tab pages and
                        set the error list to the matches.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim GrepCommands.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.012 or

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
GrepCommands-1.02.vmb.gz 1.02 2016-11-29 7.0 Ingo Karkat - Internal API changes to enable :GrepHere within a [range].
- FIX: v:searchforward requires Vim 7.2; explicitly check for its existence and else just assume forward search.
- Add dependency to ingo-library (vimscript #4433). *** You need to separately install ingo-library (vimscript #4433) version 1.012 (or higher)! ***
GrepCommands-1.01.vmb.gz 1.01 2012-08-24 7.0 Ingo Karkat BUG: Forgot to append l:patternFlags and enclose in delimiters when there's a non-whitespace pattern; this makes the GrepHere plugin's mappings wrongly jump to the first match.
GrepCommands.vba.gz 1.00 2012-08-16 7.0 Ingo Karkat Initial upload
ip used for rating:

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.
SourceForge.net Logo