Thursday, November 15, 2012

Generating ctags and cscope tags for vim

I use this script for generate ctags and cscope tags. This MinGW version is to be run in source code directory.

#!/bin/sh
workdir=`pwd`
workdir=${workdir/\/c/c:}
echo Work directory: $workdir

if [ ! -d cscope ]
then
   echo Creating cscope directory
   mkdir cscope
fi

echo Generating ctags
cd $workdir
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

echo Generating cscope
cd /
find $workdir -name "*.cpp" -or -name "*.h" > $workdir/cscope/cscope.files
cd $workdir/cscope
cscope -bq

echo Complete
For running on Linux remove
workdir=${workdir/\/c/c:}

No comments:

Post a Comment