On 6/22/2010 10:27 PM, Jim Green wrote:
Hi vim community,
I need to constantly perform a grepping of a string(eg, sth in logs)
from a large code base, now I use grep on the command line to do this.
I just started using ctags but it can not do the grepping of arbitrary
string for me.

could any vim users point me to a popular tool that I can use to
improve my efficiency, I use only vim to browse and write code so I
hope this is not off topic here.

Thank you,
Jim


mod to meet your needs...

$ cat gref
if [ $# = 1 ]
then
    dir=.
    echo "dir is $dir"
else if [ $# = 2 ]
then
    dir=$2
    echo "dir is $dir"
else
    echo "Usage: 'basename $0' pattern [path]"
    echo "         escape asterisks like so:  \$gref text /home/\*.c"
    echo "\n"
exit 1
fi
fi

find $dir -type f \! -name \*.o \! -name \*.a \! -perm 775 \! -name \*.class \! -name \*.html -exec grep -l "$1" {} \; -exec grep -n "$1" {} \; -exec echo " " \;


sample output

administra...@cyberhome ~/src/tcc-0.9.25
$ gref tcc_add_library_path .
dir is .
./libtcc.c
1826:    tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib");
1827:    tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib");
1828:    tcc_add_library_path(s, CONFIG_SYSROOT "/lib");
2039:int tcc_add_library_path(TCCState *s, const char *pathname)
2161:    tcc_add_library_path(s, buf);

./libtcc.h
77:LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);

./tcc.c
286:                tcc_add_library_path(s, optarg);


--
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

Reply via email to