forked from cinaeco/EasyGrep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
69 lines (48 loc) · 3.23 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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.