sponsor Vim development Vim logo Vim Book Ad

SearchAlternatives : Add / subtract alternatives to / from the search pattern.

 script karma  Rating -1/1, Downloaded by 67    Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
This plugin provides mappings and commands to add and subtract alternative
branches to the current search pattern. Currently searching for "foo," but
also want to find matches for "bar"? You could type /foo\|bar<CR> or
/<C-R>/\|bar<CR>, but once you want to limit the search to whole \<words\>
(like the star command), and juggle several alternatives, adding and
dropping them as you search, this plugin is quicker than manually editing the
search command-line (which you can still do).

RELATED WORKS
- Add to Word Search (vimscript #3955) can add the keyword under the cursor to
  the search pattern and search forward / backward like * / #.


USAGE
<Leader>+               Add the current whole \<word\> as an alternative to the
                        search pattern, similar to the star command.

<Leader>g+              Add the current word as an alternative to the search
                        pattern, similar to the gstar command.

{Visual}<Leader>+       Add the current selection as an alternative to the
                        search pattern.

<Leader>-               Remove the current whole \<word\> from the alternatives
                        in the search pattern.

<Leader>g-              Remove the current word from the alternatives in the
                        search pattern.

{Visual}<Leader>-       Remove the current selection from the alternatives in
                        the search pattern.

:SearchAdd {expr}       Add {expr} as an alternative to the search pattern.

:SearchRemove {expr}    Remove {expr} from the alternatives in the search
                        pattern.
:[N]SearchRemove        Remove the [N]'th / last alternative from the
                        alternatives in the search pattern.
 
install details
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.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 SearchAlternatives.vba.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.0 or higher.
 

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
SearchAlternatives.vba.gz 1.00 2012-07-26 7.0 Ingo Karkat Initial upload
ip used for rating: 50.16.36.153

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