1 download: http://www.vim.org/scripts/script.php? Script_id = 1, 311
2. decompress the grep. Vim file to the/usr/share/Vim/vim70/plugin folder.
3. Help: In the grep. Vim File Header
4 usage:
The following describes its usage:
Vim has its own search function, but it is still a little different from the grep in shell. Sometimes when coding is in a rush, I really want to press F3,
The words where the cursor is located have a full range of engineering grep, so you don't have to think about tedious commands. Now the gospel is coming, there are not a few people who are as lazy as me,
You can find instructions at the front of the grep. Vim script:
: Grep searches for the specified file according to the specified rules.
: Rgrep is the same as above, but it is recursive grep.
: Grepbuffer search in all opened Buffers
: Bgrep same as above
: Grepargs: Find in argument filenames (: ARGs) of VIM
: Fgrep run fgrep
: Rfgrep run recursive fgrep
: Egrep run egrep
: Regrep run recursive egrep
: Agrep run agrep
: Ragrep run recursive agrep
The preceding command is called like this:
: Grep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Rgrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Fgrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Rfgrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Egrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Regrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Agrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Ragrep [<grep_options>] [<search_pattern> [<file_name (s)>]
: Grepbuffer [<grep_options>] [<search_pattern>]
: Bgrep [<grep_options>] [<search_pattern>]
: Grepargs [<grep_options>] [<search_pattern>]
But I never need to knock on the ^ _ ^ of the above commands, because I am ~ /. The following sentence is added to vimrc:
Nnoremap <silent> <F3>: grep <CR>
But I never need to knock on the ^ _ ^ of the above commands, because I am ~ /. The following sentence is added to vimrc:
Nnoremap <silent> <F3>: grep <CR> |
For example, if you want to find "feat_quickfix" in/home/wooin/vim71/src/Main. C, move the cursor to "feat_quickfix" and press the F3 key, for example:
The following command lines are displayed:
Search for pattern: feat_quickfix |
Now you can edit the row. grep supports regular expressions. If you want to match the entire word, you can change it:
Search for pattern: \ <feat_quickfix \> |
Press Enter:
The following command lines are displayed:
You are asking about the search scope. By default, all files in the directory are used. You can edit this line. For example, you only want to search for the source file:
Search in files: *. C *. h |
Press enter to list all matching search results in the pop-up quickfix window. You can search for the desired results in the pop-up window, such:
From: http://blog.csdn.net/wooin/archive/2007/10/31/1858917.aspx