Showing posts with label ctags. Show all posts
Showing posts with label ctags. Show all posts

Tuesday, October 22, 2013

ctag and csope for java

The same script as in this post, but for Java:
$ cat ~/bin/javatags
#!/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 --language-force=java .

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

echo Complete

Sunday, October 20, 2013

Use :tjump instead of :tag in vim

Often when you press CTRL-] in vim there are several options to jump on. By default CTRL-] is mapped to :tag command, and you need to use :tselect after CTRL-] to see all alternatives. It is more convenient to see the list right away after pressing CTRL-]. vim already has such a command: :tjump. You just need to remap CTRL-] to :tjump instead of :tag:
nnoremap <c-]> g<c-]>
vnoremap <c-]> g<c-]>

nnoremap g<c-]> <c-]>
vnoremap g<c-]> <c-]>
Source.

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