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

Ferret : Enhanced multi-file search for Vim

 script karma  Rating 9/3, Downloaded by 689    Comments, bugs, improvements  Vim wiki

created by
Greg Hurrell
script type
Ferret improves Vim's multi-file search in four ways:

1. Powerful multi-file search ~

Ferret provides an |:Ack| command for searching across multiple files using
ripgrep (https://github.com/BurntSushi/ripgrep), The Silver Searcher
(https://github.com/ggreer/the_silver_searcher), or Ack
(http://beyondgrep.com/). Support for passing options through to the
underlying search command exists, along with the ability to use full regular
expression syntax without doing special escaping. On modern versions of Vim
(version 8 or higher, or Neovim), searches are performed asynchronously
(without blocking the UI).

Shortcut mappings are provided to start an |:Ack| search (<leader>a) or to
search for the word currently under the cursor (<leader>s).

Results are normally displayed in the |quickfix| window, but Ferret also
provides a |:Lack| command that behaves like |:Ack| but uses the |location-list|
instead, and a <leader>l mapping as a shortcut to |:Lack|.

|:Back| and |:Black| are analogous to |:Ack| and |:Lack|, but scoped to search
within currently open buffers only.

2. Streamlined multi-file replace ~

The companion to |:Ack| is |:Acks| (mnemonic: "Ack substitute", accessible via
shortcut <leader>r), which allows you to run a multi-file replace across all
the files placed in the |quickfix| window by a previous invocation of |:Ack| (or

3. Quickfix listing enhancements ~

The |quickfix| listing itself is enhanced with settings to improve its
usability, and natural mappings that allow quick removal of items from the
list (for example, you can reduce clutter in the listing by removing lines
that you don't intend to make changes to).

Additionally, Vim's |:cn|, |:cp|, |:cnf| and |:cpf| commands are tweaked to make it
easier to immediately identify matches by centering them within the viewport.

4. Easy operations on files in the quickfix listing ~

Finally, Ferret provides a |:Qargs| command that puts the files currently in
the |quickfix| listing into the |:args| list, where they can be operated on in
bulk via the |:argdo| command. This is what's used under the covers on older
versions of Vim by |:Acks| to do its work (on newer versions the built-in
|:cfdo| is used instead).
install details

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
ferret-3.0.zip 3.0 2017-06-13 7.0 Greg Hurrell - Improve handling of backslash escapes (https://github.com/wincent/ferret/issues/41).
- Add |g:FerretAutojump|.
- Drop support for vim-dispatch.
ferret-2.0.zip 2.0 2017-06-06 7.0 Greg Hurrell - Add support for Neovim, along with |g:FerretNvim| setting.
ferret-1.5.zip 1.5 2017-05-05 7.0 Greg Hurrell - Improvements to the handling of very large result sets (due to wide lines or many results).
- Added |g:FerretLazyInit|.
- Added missing documentation for |g:FerretJob|.
- Added |g:FerretMaxResults|.
- Added feature-detection for `rg` and `ag`, allowing Ferret to gracefully work with older versions of those tools that do not support all desired command-line switches.
ferret-1.4.zip 1.4 2017-01-22 7.0 Greg Hurrell - Drop broken support for `grep`, printing a prompt to install `rg`, `ag`, or
  `ack`/`ack-grep` instead.
- If an `ack` executable is not found, search for `ack-grep`, which is the
  name used on Debian-derived distros.
ferret-1.3.zip 1.3 2017-01-08 7.0 Greg Hurrell - Reset |'errorformat'| before each search (fixes issue #31).
- Added |:Back| and |:Black| commands, analogous to |:Ack| and |:Lack| but scoped to search within currently open buffers only.
- Change |:Acks| to use |:cfdo| when available rather than |:Qargs| and |:argdo|, to avoid polluting the |arglist|.
- Remove superfluous |QuickFixCmdPost| autocommands, resolving clash with Neomake plug-in (patch from Tom Dooner, #36).
- Add support for searching with ripgrep (`rg`).
ferret-1.2a.zip 1.2a 2016-05-16 7.4 Greg Hurrell - Add optional support for running searches asynchronously using Vim's |+job| feature (enabled by default in sufficiently recent versions of Vim); see |g:FerretJob|, |:FerretCancelAsync| and |:FerretPullAsync|.
ferret-1.1.1.zip 1.1.1 2016-03-07 7.0 Greg Hurrell - Fix another edge case when searching for patterns containing "#", only manifesting under dispatch.vim.
ferret-1.1.zip 1.1 2016-03-07 7.0 Greg Hurrell - Fix edge case when searching for strings of the form "<foo>".
- Fix edge case when searching for patterns containing "#" and "%".
- Provide completion for `ag` and `ack` options when using |:Ack| and |:Lack|.
- Fix display of error messages under dispatch.vim.
ferret-1.0.zip 1.0 2015-12-28 7.0 Greg Hurrell - Fix broken |:Qargs| command (patch from Daniel Silva).
- Add |g:FerretQFHandler| and |g:FerretLLHandler| options (patch from Daniel
- Make |<Plug>| mappings accessible even |g:FerretMap| is set to 0.
- Fix failure to report filename when using `ack` and explicitly scoping
  search to a single file (patch from Daniel Silva).
- When using `ag`, report multiple matches per line instead of just the first
  (patch from Daniel Silva).
- Improve content and display of error messages.
ferret-0.3.zip 0.3 2015-07-24 7.0 Greg Hurrell - Added highlighting of search pattern and related |g:FerretHlsearch| option
  (patch from Nelo-Thara Wallus).
- Add better error reporting for failed or incorrect searches.
ferret-0.2.zip 0.2 2015-07-16 7.0 Greg Hurrell - Added |FerretDidWrite| and |FerretWillWrite| autocommands (patch from Joe
- Add |<Plug>(FerretAcks)| mapping (patch from Nelo-Thara Wallus).
ferret-0.1.zip 0.1 2015-07-08 7.0 Greg Hurrell 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