vimgrep.vim : Editing utilities using grep/find without external grep/find programs
| script karma
Downloaded by 2961
Comments, bugs, improvements
|grep/find utility wholly contained in Vim. Commands implemented specifically to aid the editing task, not just find pattern matches. Vimgrep() provides grep utility without an external grep type program. It includes :help documentation grep-ing, selective or mass editing of files with matches, and display of output to command line or a named buffer. Vimfind() provides find utility without an external find type program and offers same selective/mass editing as Vimgrep(). See doc directory in package for various documentation file formats and select one for more information.|
|NOTE: REQUIRES vsutil_vim.zip http://www.vim.org/scripts/script.php?script_id=1056
Unzip into your .vim|vimfiles directory.
Rating scripts is only available on the
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.104.22.168
operates the same as
- Rewrote s:vimGrep() for
these are now separate packages
- Rewrote to change optional
arguments to switches instead
of positional arguments.
- Changed documentation to
- Some minor code clean up
- Removed use of dummy file
for empty Vim session.
|| Version 2.2
- Inappropriate inclusion of
- Added BuiltInHelp
- Added VimfindToBuf
- Added VimfindList
- Added VimgrepList
- Added VimgrepHelpList
- Added Command/Function Help
Vim[find|grep]List opens a
buffer listing file name
results from the respective
function. Then simply cursor
to a line in the list, and
press 'o' to open the listed
file in an edit buffer.
||Many's the slip
Twixt cup and lip
Somehow the wrong version
got put into the zip
This is the corrected one
- echo-ed results scrolling off
command line by adding Pause()
- problem with file argument
being '/' would append '/*' to
search which always failed.
Now only appends extra '/' if
file argument does not end in
'/' or ''.
- Stopped search after first match
if FNonly. Do no search at all
if srchpat == '\%$'
- Added Vimfind
(inspired by email from
Hari Krishna Dara)
Changed script name to vimgrep.vim
Introduced naming convention for
commands and functions. Commands
begin Vimgrep[\w*], functions and
variables begin [\w*]Vimgrep
Function MiniVimGrep() obsoleted.
Replaced with Vimgrep().
Wrapper exists to maintain
- Added opening of edit buffers
for successfully grep-ed files.
- Added help files grep-ing.
- Added delete of edit/help
- Added gvim menu/toolbar items
and key mappings for deleting.
- Included documentation files.
- rewrote, beefed up, made more
robust, and otherwise enhanced.
||The two public functions are:
MiniVimGrep(pattern,file(s),[match case],[file names only])
BufMiniGrep(pattern,[match case],[file names only])
'match case' is zero or non-zero
'file names only' is zero or non-zero
MiniVimGrep() operates on file(s) arguments and BufMiniGrep() operates on open buffers.
For grep-ing in open buffers:
- Added BufMiniGrep for grep-ing all open buffers
- Added code to set cursor to line 1, col 1 in the file in case it is
being done with open buffers. Then the cursor is set back to its
- Added code to allow passing '%' or '' for file, meaning current buffer
- Added augroup and autocmd to save the buffer number so it can be used
to return to the original buffer if grep-ing in open buffers
For multiple files
- Added code to check for comma and newline file name separators.
Comma allows the user to specify 'file' argument as
"file1,file2,...", while newline allows 'file' argument to be
something like glob(expand("%:p:h")."/*") or
- Added code to check if file is the same as the original open
buffer, if so, don't do bdelete.
- Added second optional argument for returning file names only.
If non-zero, just return file names, not the matching lines.
- Added code to test for empty files
- Added code to test for directories