Friday, February 4, 2011

Re: Using vimgrep

Excerpts from David Lam's message of Fri Feb 04 23:57:04 +0000 2011:
> you probably want... vimgrep pattern file_folder/*.c
>
> maybe more useful is going through all sub folders recursively...
> vimgrep pattern file_folder/**/*.c

If I got you correct you want to create a file like this:

== directories-to-search ==
project1/
project2/
project3/

Then you want Vim to read the lines and grep each folder which was
listed in it?

let name = input("the word to grep for :")
for folder in readfile("directories-to-search")
exec 'vimgrepadd '.fnameescape(folder)..' '.fnameescape(folder).'/**/*'
endfor

Put it into a function and map that.

Marc Weber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: