Giter VIP home page Giter VIP logo

ferret's Introduction

ferret

Intro

"ferret (verb)
(ferret something out) search tenaciously for and find something: she had the ability to ferret out the facts."

ferret-features

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. :Quack is scoped to search among the files currently in the quickfix list.

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 :Back, or :Quack).

Correspondingly, results obtained by :Lack can be targeted for replacement with :Lacks.

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 :cdo or :cfdo are used instead).

Ferret also provides a :Largs command, which is a location-list analog for :Qargs.

Installation

To install Ferret, use your plug-in management system of choice.

If you don't have a "plug-in management system of choice", I recommend Pathogen (https://github.com/tpope/vim-pathogen) due to its simplicity and robustness. Assuming that you have Pathogen installed and configured, and that you want to install Ferret into ~/.vim/bundle, you can do so with:

git clone https://github.com/wincent/ferret.git ~/.vim/bundle/ferret

Alternatively, if you use a Git submodule for each Vim plug-in, you could do the following after cd-ing into the top-level of your Git superproject:

git submodule add https://github.com/wincent/ferret.git ~/vim/bundle/ferret
git submodule init

To generate help tags under Pathogen, you can do so from inside Vim with:

:call pathogen#helptags()

Commands

:Ack

:Ack {pattern} {options}

Searches for {pattern} in all the files under the current directory (see :pwd), unless otherwise overridden via {options}, and displays the results in the quickfix listing.

rg (ripgrep) then ag (The Silver Searcher) will be used preferentially if present on the system, because they are faster, falling back to ack/ack-grep as needed.

On newer versions of Vim (version 8 and above), the search process runs asynchronously in the background and does not block the UI.

Asynchronous searches are preferred because they do not block, despite the fact that Vim itself is single threaded.

The {pattern} is passed through as-is to the underlying search program, and no escaping is required other than preceding spaces by a single backslash. For example, to search for "\bfoo[0-9]{2} bar\b" (ie. using ag's Perl-style regular expression syntax), you could do:

:Ack \bfoo[0-9]{2}\ bar\b

Likewise, {options} are passed through. In this example, we pass the -w option (to search on word boundaries), and scope the search to the "foo" and "bar" subdirectories:

:Ack -w something foo bar

As a convenience <Leader>a is set-up (<Plug>(FerretAck)) as a shortcut to enter Cmdline-mode with :Ack inserted on the Cmdline. Likewise <Leader>s (<Plug>(FerretAckWord)) is a shortcut for running :Ack with the word currently under the cursor.

:Ack!

:Ack! {pattern} {options}

Like :Ack, but returns all results irrespective of the value of g:FerretMaxResults.

:Lack

:Lack {pattern} {options}

Just like :Ack, but instead of using the quickfix listing, which is global across an entire Vim instance, it uses the location-list, which is a per-window construct.

Note that :Lack always runs synchronously via :cexpr.

:Lack!

:Lack! {pattern} {options}

Like :Lack, but returns all results irrespective of the value of g:FerretMaxResults.

:Back

:Back {pattern} {options}

Like :Ack, but searches only listed buffers. Note that the search is still delegated to the underlying 'grepprg' (rg, ag, ack or ack-grep), which means that only buffers written to disk will be searched. If no buffers are written to disk, then :Back behaves exactly like :Ack and will search all files in the current directory.

:Back!

:Back! {pattern} {options}

Like :Back, but returns all results irrespective of the value of g:FerretMaxResults.

:Black

:Black {pattern} {options}

Like :Lack, but searches only listed buffers. As with :Back, the search is still delegated to the underlying 'grepprg' (rg, ag, ack or ack-grep), which means that only buffers written to disk will be searched. Likewise, If no buffers are written to disk, then :Black behaves exactly like :Lack and will search all files in the current directory.

:Black!

:Black! {pattern} {options}

Like :Black, but returns all results irrespective of the value of g:FerretMaxResults.

:Quack

:Quack {pattern} {options}

Like :Ack, but searches only among files currently in the quickfix listing. Note that the search is still delegated to the underlying 'grepprg' (rg, ag, ack or ack-grep), which means that only buffers written to disk will be searched. If no buffers are written to disk, then :Quack behaves exactly like :Ack and will search all files in the current directory.

:Quack!

:Quack! {pattern} {options}

Like :Quack, but returns all results irrespective of the value of g:FerretMaxResults.

:Acks

:Acks /{pattern}/{replacement}/

Takes all of the files currently in the quickfix listing and performs a substitution of all instances of {pattern} (a standard Vim search pattern) by {replacement}.

A typical sequence consists of an :Ack invocation to populate the quickfix listing and then :Acks (mnemonic: "Ack substitute") to perform replacements. For example, to replace "foo" with "bar" across all files in the current directory:

:Ack foo
:Acks /foo/bar/

The pattern and replacement are passed through literally to Vim's :substitute command, preserving all characters and escapes, including references to matches in the pattern. For example, the following could be used to swap the order of "foo123" and "bar":

:Acks /\v(foo\d+)(bar)/\2\1/

:Lacks

:Lacks /{pattern}/{replacement}/

Takes all of the files in the current location-list and performs a substitution of all instances of {pattern} by {replacement}. This is an analog of the :Acks command, but operates on the location-list instead of the quickfix listing.

:FerretCancelAsync

:FerretCancelAsync

Cancels any asynchronous search that may be in progress in the background.

:FerretPullAsync

:FerretPullAsync

Eagerly populates the quickfix (or location-list) window with any results that may have been produced by a long-running asynchronous search in progress in the background.

:Qargs

:Qargs

This is a utility function that is used internally when running on older versions of Vim (prior to version 8) but is also generally useful enough to warrant being exposed publicly.

It takes the files currently in the quickfix listing and sets them as :args so that they can be operated on en masse via the :argdo command.

:Largs

:Largs

Just like :Qargs, but applies to the current location-list.

It takes the files in the current location-list and sets them as :args so that they can be operated on en masse via the :argdo command.

Mappings

Circumstances where mappings do not get set up

Note that Ferret will not try to set up the <Leader> mappings if any of the following are true:

  • A mapping with the same {lhs} already exists.
  • An alternative mapping for the same functionality has already been set up from a .vimrc.
  • The mapping has been suppressed by setting g:FerretMap to 0 in your .vimrc.

Mappings specific to the quickfix window

Additionally, Ferret will set up special mappings in quickfix listings, unless prevented from doing so by g:FerretQFMap:

  • d (visual-mode): delete visual selection
  • dd (Normal-mode): delete current line
  • d{motion} (Normal-mode): delete range indicated by {motion}

<Plug>(FerretBack)

Ferret provides <Plug>(FerretBack) which can be used to trigger the :Back command. To configure a mapping for it, use :nmap:

nmap <Leader>fb <Plug>(FerretBack)

<Plug>(FerretBlack)

Ferret provides <Plug>(FerretBlack) which can be used to trigger the :Black command. To configure a mapping for it, use :nmap:

nmap <Leader>fl <Plug>(FerretBlack)

<Plug>(FerretQuack)

Ferret provides <Plug>(FerretBack) which can be used to trigger the :Quack command. To configure a mapping for it, use :nmap:

nmap <Leader>fq <Plug>(FerretQuack)

<Plug>(FerretAck)

Ferret maps <Leader>a to <Plug>(FerretAck), which triggers the :Ack command. To use an alternative mapping instead, create a different one in your .vimrc instead using :nmap:

" Instead of <Leader>a, use <Leader>x.
nmap <Leader>x <Plug>(FerretAck)

<Plug>(FerretLack)

Ferret maps <Leader>l to <Plug>(FerretLack), which triggers the :Lack command. To use an alternative mapping instead, create a different one in your .vimrc instead using :nmap:

" Instead of <Leader>l, use <Leader>y.
nmap <Leader>y <Plug>(FerretLack)

<Plug>(FerretAckWord)

Ferret maps <Leader>s (mnemonic: "selection) to <Plug>(FerretAckWord), which uses :Ack to search for the word currently under the cursor. To use an alternative mapping instead, create a different one in your .vimrc instead using :nmap:

" Instead of <Leader>s, use <Leader>z.
nmap <Leader>z <Plug>(FerretAckWord)

<Plug>(FerretAcks)

Ferret maps <Leader>r (mnemonic: "replace") to <Plug>(FerretAcks), which triggers the :Acks command and fills the prompt with the last search term from Ferret. to use an alternative mapping instead, create a different one in your .vimrc instead using :nmap:

" Instead of <Leader>r, use <Leader>u.
nmap <Leader>u <Plug>(FerretAcks)

Options

g:FerretNvim

g:FerretNvim (boolean, default: 1)

Controls whether to use Neovim's job-control features, when available, to run searches asynchronously. To prevent this from being used, set to 0, in which case Ferret will fall back to the next method in the list (Vim's built-in async primitives -- see g:FerretJob -- which are typically not available in Neovim, so will then fall back to the next available method).

let g:FerretNvim=0

g:FerretJob

g:FerretJob (boolean, default: 1)

Controls whether to use Vim's +job feature, when available, to run searches asynchronously. To prevent +job from being used, set to 0, in which case Ferret will fall back to the next available method.

let g:FerretJob=0

g:FerretHlsearch

g:FerretHlsearch (boolean, default: none)

Controls whether Ferret should attempt to highlight the search pattern when running :Ack or :Lack. If left unset, Ferret will respect the current 'hlsearch' setting. To force highlighting on or off irrespective of 'hlsearch', set g:FerretHlsearch to 1 (on) or 0 (off):

let g:FerretHlsearch=0

g:FerretAcksCommand

g:FerretAcksCommand (string, default: "cdo")

Controls the underlying Vim command that :Acks uses to peform substitutions. On versions of Vim that have it, defaults to :cdo, which means that substitutions will apply to the specific lines currently in the quickfix listing. Can be set to "cfdo" to instead use :cfdo (if available), which means that the substitutions will be applied on a per-file basis to all the files in the quickfix listing. This distinction is important if you have used Ferret's bindings to delete entries from the listing.

let g:FerretAcksCommand='cfdo'

g:FerretLacksCommand

g:FerretLacksCommand (string, default: "ldo")

Controls the underlying Vim command that :Lacks uses to peform substitutions. On versions of Vim that have it, defaults to :ldo, which means that substitutions will apply to the specific lines currently in the location-list. Can be set to "lfdo" to instead use :lfdo (if available), which means that the substitutions will be applied on a per-file basis to all the files in the location-list. This distinction is important if you have used Ferret's bindings to delete entries from the listing.

let g:FerretLacksCommand='lfdo'

g:FerretVeryMagic

g:FerretVeryMagic (boolean, default: 1)

Controls whether the <Plug>(FerretAcks) mapping should populate the command line with the /\v "very magic" marker. Given that the argument passed to :Acks is handed straight to Vim, using "very magic" makes it more likely that the (probably Perl-compatible) regular expression used in the initial search can be used directly with Vim's (famously not-Perl-compatible) regular expression engine.

To prevent the automatic use of /\v, set this option to 0:

let g:FerretVeryMagic=0

g:FerretExecutable

g:FerretExecutable (string, default: "rg,ag,ack,ack-grep")

Ferret will preferentially use rg, ag and finally ack/ack-grep (in that order, using the first found executable), however you can force your preference for a specific tool to be used by setting an override in your .vimrc. Valid values are a comma-separated list of "rg", "ag", "ack" or "ack-grep". If no requested executable exists, Ferret will fall-back to the next in the default list.

Example:

" Prefer `ag` over `rg`.
let g:FerretExecutable='ag,rg'

g:FerretExecutableArguments

g:FerretExecutableArguments (dict, default: {})

Allows you to override the default arguments that get passed to the underlying search executables. For example, to add -s to the default arguments passed to ack (--column --with-filename):

let g:FerretExecutableArguments = {
  \   'ack': '--column --with-filename -s'
  \ }

To find out the default arguments for a given executable, see ferret#get_default_arguments().

g:FerretMaxResults

g:FerretMaxResults (number, default: 100000)

Controls the maximum number of results Ferret will attempt to gather before displaying the results. Note that this only applies when searching asynchronously; that is, on recent versions of Vim with +job support and when g:FerretJob is not set to 0.

The intent of this option is to prevent runaway search processes that produce huge volumes of output (for example, searching for a common string like "test" inside a $HOME directory containing millions of files) from locking up Vim.

In the event that Ferret aborts a search that has hit the g:FerretMaxResults limit, a message will be printed prompting users to run the search again with :Ack! or :Lack! if they want to bypass the limit.

g:FerretAutojump

g:FerretAutojump (number, default: 1)

Controls whether Ferret will automatically jump to the first found match.

  • Set to 0, Ferret will show the search results but perform no jump.
  • Set to 1 (the default), Ferret will show the search results and focus the result listing.
  • Set to 2, Ferret will show the search results and jump to the first found match.

Example override:

let g:FerretAutojump=2

g:FerretQFHandler

g:FerretQFHandler (string, default: "botright copen")

Allows you to override the mechanism that opens the quickfix window to display search results.

g:FerretLLHandler

g:FerretLLHandler (string, default: "lopen")

Allows you to override the mechanism that opens the location-list window to display search results.

g:FerretQFOptions

g:FerretQFOptions (boolean, default: 1)

Controls whether to set up setting overrides for quickfix windows. These are various settings, such as norelativenumber, nolist and nowrap, that are intended to make the quickfix window, which is typically very small relative to other windows, more usable.

A full list of overridden settings can be found in ferret-overrides.

To prevent the custom settings from being applied, set g:FerretQFOptions to 0:

let g:FerretQFOptions=0

g:FerretQFMap

g:FerretQFMap (boolean, default: 1)

Controls whether to set up mappings in the quickfix results window and location-list for deleting results. The mappings include:

  • d (visual-mode): delete visual selection
  • dd (Normal-mode): delete current line
  • d{motion} (Normal-mode): delete range indicated by {motion}

To prevent these mappings from being set up, set to 0:

let g:FerretQFMap=0

g:FerretLoaded

g:FerretLoaded (any, default: none)

To prevent Ferret from being loaded, set g:FerretLoaded to any value in your .vimrc. For example:

let g:FerretLoaded=1

g:FerretLazyInit

g:FerretLazyInit (boolean, default: 1)

In order to minimize impact on Vim start-up time Ferret will initialize itself lazily on first use by default. If you wish to force immediate initialization (for example, to cause 'grepprg' and 'grepformat' to be set as soon as Vim launches), then set g:FerretLazyInit to 0 in your .vimrc:

let g:FerretLazyInit=0

g:FerretCommandNames

g:FerretCommandNames (dictionary, default: {})

Ferret's command names are mostly chosen because the plugin started as a simple ack wrapper. As related commands were added over time, a pattern involving common suffixes evolved, to make the commands easy to remember (even once Ferret started offering support for non-ack tools, such as ag and rg). As such, :Ack, :Back, :Black, :Lack, and :Quack are all commands, as are the variants :Acks and :Lacks, along with :Qargs and :Largs. Exceptions to the pattern are :FerretCancelAsync and :FerretPullAsync.

Should you wish to override any or all of these names, you may define g:FerretCommandNames early on in your .vimrc (before Ferret is loaded), and it will use the specified names instead, falling back to the defaults for any undefined commands. For example, to use :Rg in place of the :Ack command, and :Rgb in place of :Back, but keep using the standard names for all other commands, you would write:

let g:FerretCommandNames={'Ack': 'Rg', 'Back': 'Rgb'}

Overriding may be useful to avoid conflicts with other plug-ins that compete to define commands with the same names, or simply to match personal preferences.

g:FerretAckWordWord

g:FerretAckWordWord (boolean, default: 0)

When set to 1, passes the -w option to the underlying search tool whenever <Plug>(FerretAckWord) is pressed. This forces the tool to match only on word boundaries (ie. analagous to Vim's star mapping).

The default is 0, which means the -w option is not passed and matches need not occur on word boundaries (ie. analagous to Vim's gstar mapping).

To override the default:

let g:FerretAckWordWord=1

g:FerretMap

g:FerretMap (boolean, default: 1)

Controls whether to set up the Ferret mappings, such as <Plug>(FerretAck) (see ferret-mappings for a full list). To prevent any mapping from being configured, set to 0:

let g:FerretMap=0

g:FerretQFCommands

g:FerretQFCommands (boolean, default: 1)

Controls whether to set up custom versions of the quickfix commands, :cn, :cnf, :cp an :cpf. These overrides vertically center the match within the viewport on each jump. To prevent the custom versions from being configured, set to 0:

let g:FerretQFCommands=0

g:FerretFormat

g:FerretFormat (string, default: "%f:%l:%c:%m")

Sets the 'grepformat' used by Ferret.

Functions

ferret#get_default_arguments()

ferret#get_default_arguments()

Call this with an executable name to find out the default arguments that will be passed when invoking that executable. For example:

echo ferret#get_default_arguments('rg')

This may be useful if you wish to extend or otherwise modify the arguments by setting g:FerretExecutableArguments.

Custom autocommands

FerretAsyncFinish FerretAsyncStart FerretDidWrite FerretWillWrite

For maximum compatibility with other plug-ins, Ferret runs the following "User" autocommands before and after running the file writing operations during :Acks or :Lacks:

  • FerretWillWrite
  • FerretDidWrite

For example, to call a pair of custom functions in response to these events, you might do:

autocmd! User FerretWillWrite
autocmd User FerretWillWrite call CustomWillWrite()
autocmd! User FerretDidWrite
autocmd User FerretDidWrite call CustomDidWrite()

Additionally, Ferret runs these autocommands when an async search begins and ends:

  • FerretAsyncStart
  • FerretAsyncFinish

Overrides

Ferret overrides the 'grepformat' and 'grepprg' settings, preferentially setting rg, ag, ack or ack-grep as the 'grepprg' (in that order) and configuring a suitable 'grepformat'.

Additionally, Ferret includes an ftplugin for the quickfix listing that adjusts a number of settings to improve the usability of search results.

ferret-nolist

'nolist'

Turned off to reduce visual clutter in the search results, and because 'list' is most useful in files that are being actively edited, which is not the case for quickfix results.

ferret-norelativenumber

'norelativenumber'

Turned off, because it is more useful to have a sense of absolute progress through the results list than to have the ability to jump to nearby results (especially seeing as the most common operations are moving to the next or previous file, which are both handled nicely by :cnf and :cpf respectively).

ferret-nowrap

'nowrap'

Turned off to avoid ugly wrapping that makes the results list hard to read, and because in search results, the most relevant information is the filename, which is on the left and is usually visible even without wrapping.

ferret-number

'number'

Turned on to give a sense of absolute progress through the results.

ferret-scrolloff

'scrolloff'

Set to 0 because the quickfix listing is usually small by default, so trying to keep the current line away from the edge of the viewpoint is futile; by definition it is usually near the edge.

ferret-nocursorline

'nocursorline'

Turned off to reduce visual clutter.

To prevent any of these quickfix-specific overrides from being set up, you can set g:FerretQFOptions to 0 in your .vimrc:

let g:FerretQFOptions=0

Troubleshooting

ferret-quotes

Ferret fails to find patterns containing spaces

As described in the documentation for :Ack, the search pattern is passed through as-is to the underlying search command, and no escaping is required other than preceding spaces by a single backslash.

So, to find "foo bar", you would search like:

:Ack foo\ bar

Unescaped spaces in the search are treated as argument separators, so a command like the following means pass the -w option through, search for pattern "foo", and limit search to the "bar" directory:

:Ack -w foo bar

Note that wrapping in quotes will probably not do what you want.

This, for example, is a search for "foo in the bar" directory:

:Ack "foo bar"

and this is a search for 'abc in the xyz' directory:

:Ack 'abc xyz'

This approach to escaping is taken in order to make it straightfoward to use powerful Perl-compatible regular expression syntax in an unambiguous way without having to worry about shell escaping rules; for example:

:Ack \blog\((['"]).*?\1\) -i --ignore-dir=src/vendor src dist build

FAQ

Why do Ferret commands start with "Ack", "Lack" and so on?

Ferret was originally the thinnest of wrappers (7 lines of code in my .vimrc) around ack. The earliest traces of it can be seen in the initial commit to my dotfiles repo in May, 2009 (https://wincent.dev/h).

So, even though Ferret has a new name now and actually prefers rg then ag over ack/ack-grep when available, I prefer to keep the command names intact and benefit from years of accumulated muscle-memory.

Related

Just as Ferret aims to improve the multi-file search and replace experience, Loupe does the same for within-file searching:

https://github.com/wincent/loupe

Website

Source code:

https://github.com/wincent/ferret

Official releases are listed at:

http://www.vim.org/scripts/script.php?script_id=5220

License

Copyright 2015-present Greg Hurrell. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Development

Contributing patches

Patches can be sent via mail to [email protected], or as GitHub pull requests at: https://github.com/wincent/ferret/pulls

Cutting a new release

At the moment the release process is manual:

  • Perform final sanity checks and manual testing
  • Update the ferret-history section of the documentation
  • Verify clean work tree:
git status
  • Tag the release:
git tag -s -m "$VERSION release" $VERSION
  • Publish the code:
git push origin main --follow-tags
git push github main --follow-tags
  • Produce the release archive:
git archive -o ferret-$VERSION.zip HEAD -- .

Authors

Ferret is written and maintained by Greg Hurrell <[email protected]>.

Other contributors that have submitted patches include (in alphabetical order):

  • Andrew Macpherson
  • Daniel Silva
  • Filip Szymaล„ski
  • Joe Lencioni
  • Jon Parise
  • Nelo Wallus
  • Tom Dooner
  • Vaibhav Sagar
  • Yoni Weill
  • fent

This list produced with:

:read !git shortlog -s HEAD | grep -v 'Greg Hurrell' | cut -f 2-3 | sed -e 's/^/- /'

History

main (not yet released)

5.1 (9 July 2021)

  • Add g:FerretAckWordWord setting, to pass -w to the underlying search tool when <Plug>(FerretAckWord) is pressed (#66).
  • Use :normal! instead of :normal to avoid running custom mappings (patch from Yoni Weill, #67).
  • Append a trailing slash when autocompleting a directory name (#69).
  • Fixed failure to detect pre-existing mapping to <Plug>(FerretLack).
  • Worked around breakage caused by rg v13.0.0 (#78).

5.0 (8 June 2019)

  • The <Plug>(FerretAcks) mapping now uses /\v "very magic" mode by default. This default can be changed using the g:FerretVeryMagic option.
  • :Acks now preferentially uses :cdo (rather than :cfdo) to make replacements, which means that it no longer operates on a per-file level and instead targets individual entries within the quickfix window. This is relevant if you've used Ferrets mappings to delete entries from the window. The old behavior can be restored with the g:FerretAcksCommand option.
  • Ferret now has a :Lacks command, an analog to :Acks which applies to the location-list.
  • Likewise, Ferret now has a :Largs command, analogous to :Qargs, which applies to the location-list instead of the quickfix window.
  • The Ferret bindings that are set-up in the quickfix window when g:FerretQFMap is enabled now also apply to the location-list.

4.1 (31 January 2019)

  • Added :Quack command, analogous to :Ack but scoped to the files currently listed in the quickfix window.
  • Fixed option autocompletion.

4.0.2 (11 January 2019)

  • Restore compatibility with versions of rg prior to v0.8 (#59).

4.0.1 (8 January 2019)

  • Make :Acks behavior the same irrespective of the 'gdefault' setting.

4.0 (25 December 2018)

3.0.3 (23 March 2018)

  • Fix for :Lack results opening in quickfix listing in Neovim (#47).

3.0.2 (25 October 2017)

3.0.1 (24 August 2017)

  • Fix failure to handle search patterns containing multiple escaped spaces (#49).

3.0 (13 June 2017)

  • Improve handling of backslash escapes (#41).
  • Add g:FerretAutojump.
  • Drop support for vim-dispatch.

2.0 (6 June 2017)

1.5 "Cinco de Cuatro" (4 May 2017)

  • 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.

1.4 (21 January 2017)

  • 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.

1.3 (8 January 2017)

  • 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).

1.2a (16 May 2016)

1.1.1 (7 March 2016)

  • Fix another edge case when searching for patterns containing "#", only manifesting under dispatch.vim.

1.1 (7 March 2016)

  • 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.

1.0 (28 December 2015)

  • Fix broken :Qargs command (patch from Daniel Silva).
  • Add g:FerretQFHandler and g:FerretLLHandler options (patch from Daniel Silva).
  • 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.

0.3 (24 July 2015)

  • Added highlighting of search pattern and related g:FerretHlsearch option (patch from Nelo-Thara Wallus).
  • Add better error reporting for failed or incorrect searches.

0.2 (16 July 2015)

0.1 (8 July 2015)

ferret's People

Contributors

cpixl avatar fent avatar fuzzbomb avatar infokiller avatar jparise avatar lencioni avatar tdooner avatar vaibhavsagar avatar wincent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ferret's Issues

Async searching gives "E117: Unknown function: ferret#private#shared#finalize_search"

Trying an async search gives the following error message:

Error detected while processing function ferret#private#async#close_cb:
line   10:
E117: Unknown function: ferret#private#shared#finalize_search

Vim becomes unresponsive for the duration of the "search", though no results show up. It looks like this might have happened in 1c210c9 as the finalize_search function only seems to be called, not defined:

% pwd
/Users/johno/src/dotfiles/vim/bundle/ferret

% rg finalize_search
autoload/ferret/private/async.vim
107:    call ferret#private#shared#finalize_search(l:info.output, l:info.ack)
117:    call ferret#private#shared#finalize_search(l:info.output, l:info.ack)

autoload/ferret/private/vanilla.vim
7:  call ferret#private#shared#finalize_search(l:output, a:ack)

Async execution is confirmed working with other plugins (i.e. https://github.com/skywind3000/asyncrun.vim). Here's the :version output if that's helpful:

:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 30 2017 10:36:10)
MacOS X (unix) version
Included patches: 1-589
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +clipboard       +dialog_con      +file_in_path    +job             -lua             +mouse_sgr       +path_extra      +rightleft       +tag_old_static  +user_commands   +writebackup
+arabic          +cmdline_compl   +diff            +find_in_path    +jumplist        +menu            -mouse_sysmouse  +perl            +ruby            -tag_any_white   +vertsplit       -X11
+autocmd         +cmdline_hist    +digraphs        +float           +keymap          +mksession       +mouse_urxvt     +persistent_undo +scrollbind      -tcl             +virtualedit     -xfontset
-balloon_eval    +cmdline_info    -dnd             +folding         +lambda          +modify_fname    +mouse_xterm     +postscript      +signs           +termguicolors   +visual          -xim
-browse          +comments        -ebcdic          -footer          +langmap         +mouse           +multi_byte      +printer         +smartindent     +terminfo        +visualextra     -xpm
++builtin_terms  +conceal         +emacs_tags      +fork()          +libcall         -mouseshape      +multi_lang      +profile         +startuptime     +termresponse    +viminfo         -xsmp
+byte_offset     +cryptv          +eval            -gettext         +linebreak       +mouse_dec       -mzscheme        -python          +statusline      +textobjects     +vreplace        -xterm_clipboard
+channel         +cscope          +ex_extra        -hangul_input    +lispindent      -mouse_gpm       +netbeans_intg   +python3         -sun_workshop    +timers          +wildignore      -xterm_save
+cindent         +cursorbind      +extra_search    +iconv           +listcmds        -mouse_jsbterm   +num64           +quickfix        +syntax          +title           +wildmenu
-clientserver    +cursorshape     +farsi           +insert_expand   +localmap        +mouse_netterm   +packages        +reltime         +tag_binary      -toolbar         +windows
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.0.0 -lobjc

:Back throws an error

:Back test
always returns

Error detected while processing function ferret#private#back:
line    1:
E730: using List as a String
E116: Invalid arguments for function call

I have newest neovim and ferret.

Translate Perl-compatible patterns to Vim regular expression syntax

:Ack can take fancy Perl-compatible regular expressions.

If you then run :Acks with the same pattern, Vim may not actually find anything, because its patterns are not Perl-compatible, even with the \v flag.

Doing 100% compatible translation would be impossible, as Perl regexen have features that Vim's do not, but we can handle the simple cases at least (eg. \bfoo\b could become <foo>, although we'd need to decide what to do with \bfoo).

ag --vimgrep is not working well

When using ag, the grepprg is set to ag --vimgrep that outputs the same line multiple times if there is more than one match. The problem is that currently all lines are being highlighted in all matches... and it will conflict with #23, where the user won't be able to filter out some of the matches in the same line (:Acks will apply the changes in the entire line). Also the ack tool don't have the option to output the same line multiple times according to each match.

The point is, is --vimgrep really useful? It (currently) won't give a nice highlighting, won't work well with #23 :Acks and can't be reproduced when using ack.

Search gives a list of seemingly correct search results in an error message

If I run :Ack main_view, I get a response that looks like this:

app.py:42:42     from {{ project_name }}.views import main_view
[a bunch more lines with valid search results]
Search for `main_view` failed: press ENTER to continue

I never get a quickfix opened or anything interactable. Not really sure where to start in debugging this.

I have ag version 0.31.0 on an Ubuntu 16.04 machine.

Don't bind to Leader by default

IMO this is only prone to problems, I personally have bound a and s, this plugin would overwrite those.

It provides <Plug> bindings, so it isn't necessary to bind it to anything by default, let the user figure that out.

Suggestion: override cfdo with cdo using a gate?

One workflow I got bitten is when I try to edit the quicklist and do an :Acks /foo/bar/ only to find my deleted entries replaced. :Acks is using :cfdo and operates per file. If the deleted entries file path still in the quicklist (there are entries you haven't deleted), it'll replace all occurrences still, which I find it counterintuitive.

While :cdo is generally slower than its :cfdo counterpart, if your workflow includes deleting entries in the quicklist, basically refining it via :Quacks and manual editing. Shouldn't it default to :cdo instead of :cfdo that way it'll respect the quicklist you edited?

Here are a couple of suggestions:

  1. If the user edits the quicklist, :Acks will default to :cdo under the hood.
  2. Or there can be another mapping :Ackr/:Acksc/:Ackc? Which maps with cdo.
  3. ability to override Acks with :cdo.
  4. Or replace :cfdo with :cdo since the results are the same. (If it's using async jobs, I don't think it's going be a problem if it's a tad slower?)

Multi-word :Ack gives me errors

I'm trying to switch from my Ack configuration I stole from your dotfiles ages ago to ferret, and I'm running into issues when trying to :Ack for multi-word strings. I've tried :Ack "foo bar", :Ack 'foo bar', :Ack /foo bar/, :Ack \foo bar\, and :Ack foo bar and I always get the same type of error (these errors are for the version with double quotes):

ERR: Error stat()ing: bar"
ERR: Error opening directory bar": No such file or directory

I tried both with and without vim-dispatch and had similar results.

Allow `c` option for confirmation when using Acks

Mass find and replace is a great first step, but I typically always confirm each of my replacements. Currently if you try to do something like :Acks /foo/bar/c it throws an error. My guess is that you're just passing this to argdo in which case any options should be sent verbatim to argdo. Including if the user chooses to do a find/replace with something other than / as the delimiter.

For example: :Acks -some/thing/with/slashes-another/thing/with/slashes-c

ag: unrecognized option '--vimgrep'

Error running search using ag. ag: unrecognized option '--vimgrep' on Ubuntu 14.04 (Ubuntu bash for windows 10), installed using apt-get install silversearcher-ag

Option to not open first found file automatically

As asked in #13, I'm filling a new issue for this topic.
Maybe it would be better to have on option to not open the file when searching (and maybe it could be the default), as the user may be only looking for the existence of some search term on the project, and don't intend to lose focus from the current code (yeah, it's possible to go back to where it was by pressing <c-o>, but sometimes it's inconvenient to use it everytime when using ferret).

Ferret's autocommands clash with other plugins quickfix/loclist display settings

Hey @wincent, I've got an issue with Ferret clashing with Neomake.

After some digging I've traced it to this autocommand:

autocmd QuickFixCmdPost l* nested lwindow

Without ferret, when I run :Neomake on saving a file, neomake fills the loclist with linter/build output and then looks at some configuration to determine whether to call lwindow and with what argument. This allows users to disable the location list popping up, or to change its height.

Problem being, that ferret autocommand hook for QuickFixCmdPost is calling lwindow unconditionally, so the Neomake configuration settings have no effect.

Happy to attempt a PR for this, but wanted to ping you first to ask:

  • Does it make sense to just run lwindow / cwindow in ferret#private#complete instead?
  • Can the autocommand subscribers be scoped to some more-ferret-specific event names?

Thanks! And thanks for ferret, it's been really useful to me!

Add a binding to reload the quickfix window

First of all, thank you for this cool plugin!

Having a binding to reload the quickfix window would be really nice. Maybe a command like :Rack to repeat the last search could do the trick? Then we could do something like

autocmd FileType qf nnoremap <buffer> r :Rack<cr>

Bad interaction with syntastic plugin since 7.4.2299 patch applied

Here's the beginning of this issue: Undefined variable: b:syntastic_changedtick with after vim patch 7.4.2299 applied.

I've isolated this with a instance of vim running with only the syntastic and ferret plugins loaded.

I'm guessing this has something to do with how ferret and syntastic try to access/update the quickfix and/or location windows, since the error only occurs when I have syntastic displaying its error list in a location window.

Let me know what kind of info you need to further debug this issue.. not sure if other plugins will be affected.

Enhancement: option to disable syntastic when running :Acks

I use Syntastic, but don't want it to run when doing multi-file find/replace via :Acks because it adds no value but it slows down the operation considerably. I have currently added the following mapping in a .vim/after/plugin/ferret.vim file:

" Wrapper around ferret's `:Acks` to disable and re-enable syntastic for speed.
function! Acks(command)
  " Syntastic makes saving slow, and since we aren't looking at the files to see
  " the warnings, we want to disable it when running through the files.
  SyntasticToggleMode

  call ferret#private#acks(a:command)

  " Re-enable syntastic.
  SyntasticToggleMode
endfunction

command! -nargs=1 Acks call Acks(<q-args>)

But others might want this functionality and might benefit from having an option baked into ferret itself. I'm also a little uncomfortable calling into something labeled "private". However, this is simple enough that it probably doesn't add a whole lot of value to ferret, and I can see the argument for not wanting to support every other plugin. However, I believe that Syntastic is popular enough that it might be worth baking something like this in to an option.

Would you be open to a pull request that adds this feature?

First result might be prefixed with "^[[?25h^[[0G^[[?25h^[[0G" in "older" Vim

I'm not entirely sure when this started happening, but lately when I use :Ack, the first result was prefixed with ^[[?25h^[[0G^[[?25h^[[0G in the quickfix window. Obviously this prevents me from being able to press enter to open that result.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 29 2016 08:31:57)
MacOS X (unix) version
Included patches: 1-1795
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +termtruecolor
+channel         -gettext         -mzscheme        +textobjects
+cindent         -hangul_input    +netbeans_intg   +timers
-clientserver    +iconv           +packages        +title
+clipboard       +insert_expand   +path_extra      -toolbar
+cmdline_compl   +job             +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native
 -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/Users/joe_lencioni/.rbenv/versions/2.3.0/lib  -fstack-protector -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.11/Frameworks -frame
work Python   -lruby-static -framework CoreFoundation -lobjc -L/Users/joe_lencioni/.rbenv/versions/2.3.0/lib

After updating Vim to include patches 1-1941, this problem seems to go away

More flexible editing within the quickfix window

My general workflow for large edits has been to use the 'jceb/vim-editqf' plugin to search, edit the quickfix results, and use 'dsummersl/vim-cdo' to make changes. I love the idea of these two activities unified in ferret!

I'd like to be able to use '.' and ':g//del' in quickfix window, but there are probably other commands that would be helpful for editing...I understand opening it up as a standard buffer like vim-editqf might be a little too buggy (then you gotta worry about ppl making un-parsable changes to the buffer), but it would be nice to have a more options when it comes to modifying the quicklist buffer.

Thanks!

ferret make <cword> not working.

my vimrc:

map <F4> :Ack! -w <cword><cr/>

after i installed ferret, <cword> not working, it can't expand to the word under cursor.

Provide ability to override default options passed to each executable

I have these 2 map in my init.vim:

nmap <leader>a <Plug>(FerretAck)
nmap <leader>z <Plug>(FerretAckWord)

I want the results exclude specific files such as tags. (I guess full command gonna look like :Ack . --ignore-file=is:tags
I have ~/.ackrc that can be perform this way in Ack command line.
But in neovim, it didn't work.

Any suggestions?

Add `:Back` and `:Black` commands

Like :Ack and :Lack respectively, but scoped to the currently open buffers.

If the user specifies a path, could use that to filter the results, or maybe just keep things simple and disallow path arguments.

allow umap key as feature

I sometimes accidently do <leader>r and typing, until I realize it was changing quite a lot thing in my buffers
I can map it to another keys but I think an option to unmap key is very helpful

Thanks

Present errors to user in helpful way

(Forking this from #1).

We should catch some common classes of errors and show the user a helpful warning in the quickfix listing.

  • Trying to search in a non-existent directory (ie. :Ack foo bar)
  • Trying to use quotes (ie. :Ack 'foo bar' or :Ack "foo bar")

Both of those are going to produce errors like:

|| ERR: Error stat()ing: bar'
|| ERR: Error opening directory bar': No such file or directory

Another mistake would be the non-space case (:Ack 'foo'). That won't run into a stat error, but it won't find "foo" either (it's looking for single quote followed by "foo" followed by single quote).

The problem with catching stat errors is they'll likely be slightly different from platform to platform, so we need to find the right way to detect them without risking false positives (alas, we don't necessarily get access to the exit status of the underlying process).

As for catching errors for the 'foo' case, we can probably just consider it an error whenever a search is wrapped in quotes and doesn't return any results.

replace words usage ?

love your work !

but when i want to replace something i get this (:Acks /foo/bar/ ):
q

:Ack does not find strings after 4.0.0 update

After the 4.0.0 update the :Ack command no longer finds strings that exists in files.

By the way; thanks for a great plugin!

Let me know if you need anymore info.

Environment:
OS: Ubuntu 16.04
Search executable: rg
vim:

NVIM v0.3.1
Build type: RelWithDebInfo
LuaJIT 2.0.4
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-xZey2V/neovim-0.3.1/build/config -I/build/neovim-xZey2V/neovim-0.3.1/src -I/usr/include -I/build/neovim-xZey2V/neovim-0.3.1/build/src/nvim/auto -I/build/neovim-xZey2V/neovim-0.3.1/build/include
Compiled by [email protected]

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Can get it work

I just want to search word "name" in all files

:Ack \bname\

image

Am I doing something wrong?

Play nicely with 'autochdir'

Firstly, I use ferret all the time - great plugin! However, I also like autochdir (or at least a custom function that doesn't conflict with plugins like dirvish, and this have written a small wrapper around ferret to walk up directories until it finds a .git/ directory and run ferret from there to search project-wide. (See function in my dotfiles)
However, this has stopped working, because it seems that ferret now returns relative file names or something like that so when I open the file from the quickfix window it displays as a new file instead (because the file wasn't found). I'm wondering if there would be a way to make this work again, or if it would be possible to build this feature into ferret itself?

I don't know much vimscript, but would be happy to experiment and submit a pull request if possible (and I get a little support).

Thanks.

Add back fallback support for `grep`

This was removed in 1.4 because it didn't work at all.

But it would be nice to add it back.

I think the right way to do this might be by adding the ability to customize the executable and args used (beyond the current hard-coded list). My main concern is that grep may vary a fair bit from platform to platform (BSD grep vs GNU grep etc), so getting a default config that works everywhere might be fiddly and brittle.

Ack command does not work on Windows 10 for Neovim

I installed the latest version of ferret both on Linux and my Windows machine with Neovim. On Linux, it works as expected. But on Windows, the command Ack simply does not work.

Version info

  • Neovim: version 0.3.4
  • Windows: Windows 10 version 1803
  • rg: 0.10.0

steps to reproduce

  1. Use the following minimal init.vim
" use vim-plug to manage plugins
call plug#begin('~/AppData/Local/nvim/plugged')

" multi file search
Plug 'wincent/ferret'

call plug#end()

""""""""""""""""""""""""""""""ferret settings""""""""""""""""""""""""""""""
" do not use default mapping provided by ferret
let g:FerretMap=0

" use \f to activate :Ack command
nmap \f <Plug>(FerretAck)

" hilight search result by default
let g:FerretHlsearch=1

" prefer to use rg
let g:FerretExecutable='rg,ag'

" custom option for search prog
let g:FerretExecutableArguments = {
  \   'rg': '-S --no-heading --vimgrep'
    \ }

Open neovim with the following command:

" use the above minimal init.vim
nvim -u init.vim
  1. Use :Ack some_string to search string under the current folder. Nothing happens. If I run the search command again, the following error is produced:
Error detected while processing function ferret#private#ack[11]..ferret#private#nvim#search[1]..ferret#private#nvim#cancel:
line    3:
E474: Invalid argument
  1. Open a file and search string inside this file with :Back some_string. It works without any error.

Unknown function: job_start

I recently updated NeoVim, and am now getting the following error when calling :Ack:

Error detected while processing function ferret#private#ack[9]..ferret#private#async#search:
line    4:
E117: Unknown function: job_start
E15: Invalid expression: job_start(l:command_and_args, {   'err_cb': 'ferret#private#async#err_cb',   'out_cb': 'ferret#private#async#out_cb',   'close_cb': 'ferret#
private#async#close_cb',   'err_mode': 'raw',   'out_mode': 'raw' })

I just updated to current master and still getting same error. Any clues?

Small error in the documentation

In the mapping section the documentation says:

Circumstances where mappings do not get set up ~
....
- The mapping has been suppressed by setting |g:FerretMap| to 1 in your |.vimrc|.

But then the section explaining g:FerretMap seems to say the contrary to me. (0 is the correct value to disable the mappings)

Controls whether to set up the Ferret mappings, such as |<Plug>(FerretAck)|
(see |ferret-mappings| for a full list). To prevent any mapping from being
configured, set to 0:
>    let g:FerretMap=0

Use currently active split instead of bottom right

Currently, when using splits, qickfix always appears on bottom-right split, and when opening files from quickfix it always opens in bottom-right split, and at start opens first file found in current split, so it replaces files in two open splits - current on search, and bottom right on switching files from quickfix.

I think you should do it like ctrl-p does - open at bottom of editor window or at bottom of currently active split, and open files in currently active split instead of bottom-right, and do not open first found file automatically (or at least make it configurable).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.