Searching in all files in a directory

This is a discussion on Searching in all files in a directory within the Editors forums in Theory and Concepts category; I know this is probably a stupid question, but is there a way to quickly use gvim to search for a pattern in all the files in a directory, whether they are .vim, .php, .js, .css, etc.? bgold12...

Go Back   Application Development Forum > Theory and Concepts > Editors

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-22-2008, 06:12 AM
bgold12
Guest
 
Default Searching in all files in a directory

I know this is probably a stupid question, but is there a way to
quickly use gvim to search for a pattern in all the files in a
directory, whether they are .vim, .php, .js, .css, etc.?

bgold12
Reply With Quote
  #2  
Old 08-22-2008, 08:38 AM
John Delaney
Guest
 
Default Re: Searching in all files in a directory

On Aug 22, 11:12*am, bgold12 <bgol...@gmail.com> wrote:
> I know this is probably a stupid question, but is there a way to
> quickly use gvim to search for a pattern in all the files in a
> directory, whether they are .vim, .php, .js, .css, etc.?


How about this:

:grep foo *.php
:copen
Reply With Quote
  #3  
Old 08-22-2008, 11:14 AM
Mikolaj Machowski
Guest
 
Default Re: Searching in all files in a directory

bgold12 scripsit:
> I know this is probably a stupid question, but is there a way to
> quickly use gvim to search for a pattern in all the files in a
> directory, whether they are .vim, .php, .js, .css, etc.?
>


:vimgrep /pattern/ *.vim

m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Vim Universal Templates: http://vim.sf.net/script.php?script_id=1078
vim.pl - http://skawina.eu.org/mikolaj
CLEWN - http://clewn.sf.net
Reply With Quote
  #4  
Old 08-23-2008, 02:44 PM
zzapper
Guest
 
Default Re: Searching in all files in a directory

On Aug 22, 4:14*pm, Mikolaj Machowski <mikm...@wp.pl> wrote:
> bgold12 scripsit:
>
> > I know this is probably a stupid question, but is there a way to
> > quickly use gvim to search for a pattern in all the files in a
> > directory, whether they are .vim, .php, .js, .css, etc.?

>
> :vimgrep /pattern/ *.vim
>
> m.
> --


also

:set wildignore=*.o,*.obj,*.bak,*.exe,*.aux,*.dvi,*.jpg ,*.gif,*.jpeg

:vimgrep /pattern/ *.*

--
zzapper
Best of VimTips
http://vim.wikia.com/wiki/Best_Vim_Tips




Reply With Quote
  #5  
Old 08-23-2008, 09:10 PM
John Beckett
Guest
 
Default Re: Searching in all files in a directory

zzapper wrote:
>> :vimgrep /pattern/ *.vim

>
>also
>
>:set wildignore=*.o,*.obj,*.bak,*.exe,*.aux,*.dvi,*.jpg ,*.gif,*.jpeg
>
>:vimgrep /pattern/ *.*


Are you sure? I just tried

:set wildignore=*.txt
:vimgrep /pattern/ *

and I found *.txt files containing 'pattern'.

John

Reply With Quote
  #6  
Old 08-24-2008, 05:24 AM
zzapper
Guest
 
Default Re: Searching in all files in a directory

On Aug 24, 2:10*am, John Beckett <nom...@thanks.junk> wrote:
> zzapper wrote:
> >> :vimgrep /pattern/ *.vim

>
> >also

>
> >:set wildignore=*.o,*.obj,*.bak,*.exe,*.aux,*.dvi,*.jpg ,*.gif,*.jpeg

>
> >:vimgrep /pattern/ * *.*

>
> Are you sure? I just tried
>
> :set wildignore=*.txt
> :vimgrep /pattern/ *
>
> and I found *.txt files containing 'pattern'.
>
> John


Whoops It would seem that wildignore is only used for completion
purposes
zzapper
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:43 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.