How to use ctags and vim to jump to java methods
Solution 1:
I use Universal Ctags with the command
ctags --languages=java -R ./src
I was confused at first because a different version of ctags comes preinstalled on osx. Turns out I first had to replace it with universal-ctags
brew install --HEAD universal-ctags/universal-ctags/universal-ctags
Solution 2:
I am using Exuberant Ctags 5.8
and run the following script to generate a tags
file for my java directory:
#!/bin/bash
# zero out any previously generated tags file
# an alternative way to achieve this is by `> tags`
truncate --size 0 tags
find . -name \*.java -exec ctags --append {} \;
I use find
and --append
because there are more than 1000 .java
files in the directory.
No problems with VIM - Vi IMproved 8.0
.