I am using ":ta " to jump to a method.
For example i got two classes named A.java
and B.java
. They both have a foo()
method and B.java have another method called fooBar()
. Then i open A.java
and input :ta foo
then press TAB then i will got two completion : foo
and fooBar
. But what i want to jump now is just tag in current file, i don't like tag in other file to display.
Depending on how many times you call your methods a couple of *
may be enough.
Without using tags, gd
can be used to go to the local declaration of the method under your cursor. I tend to choose the most low-tech solution usually, so I would go with this one.
But ctags
is also able to generate tags for a single file only or for an arbitrary selection of files. It can be done in a few steps but it's definetely not as straightforward as what you are accustomed to do…
Create a file with the name(s) of the file(s) you want to scan. Let's say it's called files.txt
and it's located at the root of your working directory.
Generate your tags
file using the -L <file>
argument: ctags -L files.txt
.
At this point you should have a tags
file containing only the tags present in the file(s) specified at step 1.
Generating different tags
files for the whole project and for single files may be useful, here. A short script generating a tags
file named after the current file and making it the sole tags
source may make the whole thing easier.
EDIT
Actually, TagList and TagBar don't generate tags
files. The output of the ctags <options>
command they run is used internally and parsed with all kinds of regexp to filter by scope or filename or whatever.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With