Skip to content

addadi/EasyGrep

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is fork of EasyGrep adding highlighting of search terms to the quickfix
window.

Highlighting is controlled by a new option in the Options Window, and can be set
as default by adding the following option to .vimrc,

    let g:EasyGrepHighlightQfMatches = 1

Colours are controlled through the EasyGrepQfMatchHighlight highlight group.


This is a mirror of http://www.vim.org/scripts/script.php?script_id=2438

EasyGrep makes using vimgrep easier.  When using EasyGrep, searching for a word is as easy as typing <leader>vv (v v, not double-u) over the word for which you want to search.  This search can also be accomplished with the :Grep command.

EasyGrep provides three modes in which you can do your searches:
  All - all files will be searched  (default)
  Buffers - all files currently open in vim will be searched
  TrackExt - all files that match the extension of the currently opened file will be searched.  Additionally, this extension can be mapped to a user defined set of extensions that will also be searched (see EasyGrepFileAssociations).
    For example: when test.cpp is open, files that match any one of *.cpp *.hpp *.cxx *.hxx *.cc *.c *.h will be searched when a search is initiated.

Setting options is easy, simply type <leader>vo or :GrepOptions.  EasyGrep provides a great set of defaults but can also be configured to start up just how you like it; see the script for these options.  Most vimgrep (and grepprg) options are supported.

For a screencast of the script in action go here: http://downloads.veryspeedy.net/vim/EasyGrep.gif

Full keymappings and commands:


    <Leader>vv  - Grep for the word under the cursor, match all occurences,
                  like |gstar|
    <Leader>vV  - Grep for the word under the cursor, match whole word, like
                  |star|
    <Leader>va  - Like vv, but add to existing list
    <Leader>vA  - Like vV, but add to existing list

    <Leader>vr  - Perform a global search search on the word under the cursor
                  and prompt for a pattern with which to replace it.

In addition to grepping the word under the cursor, text may be visually
selected and these mappings may be used analogously to as they are used above.
Visual selections will automatically be escaped so as not to confuse the
selection with a regular expression.

    Each of the above commands will search files according to settings
    controlled by:

    <Leader>vo  - Select the files to search in and set grep options

    :Grep [arg]
        Search for the specified arg, like <Leader>vv.  When an ! is added,
        search like <Leader>vV

    :GrepAdd [arg]
        Search for the specified arg, add to existing file list, as in
        <Leader>va.  When an ! is added, search like <Leader>vA

    :Replace [target] [replacement]
        Perform a global search and replace.  The function searches
        the same set of files a grep for the desired target and opens a dialog to
        confirm replacement.

    :ReplaceUndo
        Undoes the last :Replace operation.  Does not stack successive
        searches; only the last replace may be undone.  This function may not
        work well when edits are made between a call to Replace and a call to
        ReplaceUndo.

    :GrepOptions [arg]
        Open a window to set grep options.

About

Fast and Easy Find and Replace Across Multiple Files

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 100.0%