Suppose I’m searching a class JFactory inside a folder and it’s sub-directories.
How can I file that file which contains class JFactory?
I don’t want to replace that word but I need to find that file that contains class JFactory.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can replace the pattern
/JFactory/with/\<JFactory\>/if you want full word match.:vimis shorthand for:vimgrep.If
JFactoryor\<JFactory\>is your current search pattern (for example you have hit*on one occurrence) you can use an empty search pattern::vimgrep // **/*.java, it will use last search pattern instead. Handy!Warning:
:vimgrepwill trigger autocmds if enabled. This can slow down the search. If you don’t want that you can do:which will be quicker. But: it won’t trigger syntax highlighting or open
gzfiles ungzipped, etc.Note that if you want an external program to grep your pattern you can do something like the following:
Ackis a Perl-written alternative to grep. Note that then, you will have to switch to Perl regexes.Once the command of your choice returned, you can browse the search results with those commands described in the Vim documentation at
:help quickfix. Lookup:cfirst,:cnext,:cprevious,:cnfile, etc.2014 update: there are now new ways to do that with
the_silver_searcherorthe_platinum_searcherand eitherag.vimorunite.vimplugins.