快速使用cscope和ctags的脚本
发表于 : 2011-11-02 11:08
每次使用cscope 都要打上一大串命令,很麻烦,还不如使用ctags,一句命令就可以了:ctags -R,但是可惜ctags有时候会找不到某些链接
今天给cscope编了个脚本,可以方便的使用cscope:
#!/bin/bash
ctags -R;
cur_dir=$(pwd);
file_name="/cscope.files";
if [ -f $cur_dir$file_name ]; then
echo $cur_dir$file_name"Already exists";
else
find $(pwd) -name "*.as" -o -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp">$cur_dir$file_name;
echo "generate cscope.files;";
fi
if [ -f $cur_dir"/cscope.out" ]; then
echo $cur_dir"cscope.out Already exists";
else
cscope -bkq -i cscope.files;
echo "generate cscope.out;";
fi
vim -t main -c "cs add cscope.out";
把脚本复制到bin目录下:
sudo cp CreateCscope /usr/bin/
以后每次只要使用CreateCscope就可以很方便的使用了!
今天给cscope编了个脚本,可以方便的使用cscope:
#!/bin/bash
ctags -R;
cur_dir=$(pwd);
file_name="/cscope.files";
if [ -f $cur_dir$file_name ]; then
echo $cur_dir$file_name"Already exists";
else
find $(pwd) -name "*.as" -o -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp">$cur_dir$file_name;
echo "generate cscope.files;";
fi
if [ -f $cur_dir"/cscope.out" ]; then
echo $cur_dir"cscope.out Already exists";
else
cscope -bkq -i cscope.files;
echo "generate cscope.out;";
fi
vim -t main -c "cs add cscope.out";
把脚本复制到bin目录下:
sudo cp CreateCscope /usr/bin/
以后每次只要使用CreateCscope就可以很方便的使用了!