Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created 2003 · complexity basic · author David Fishburn · version 6.0
ANT is an XML-based make utility (mainly for Java, http://ant.apache.org).
A build file can have several projects, and each project can have many targets. Here is a simple example:
ant clean ant compile ant run
Editing an ANT file can be tiresome looking for the appropriate target entry.
Using the taglist plugin at least version 2.02 you can easily navigate an ANT file by creating these entries:
In your vimrc file:
let g:tlist_ant_settings = 'ant;p:Project;t:Target'
And either add to or create a ctags.cnf file:
--langdef=ant --langmap=ant:.xml --regex-ant=/^[ \t]*<[ \t]*project.*name="([a-zA-Z0-9 ]+)".*>/\1/p,project/i --regex-ant=/^[ \t]*<[ \t]*target.*name="([a-zA-Z0-9 ]+)".*>/\1/t,target/i
To determine where to create the ctags.cnf file see the ctags documentation (http://ctags.sourceforge.net/ctags.html, on WinXP this file goes into C:\Documents and Settings\local_user_name\ctags.cnf).
When this is used in conjuction with the Vim compiler for ANT and a Vim Menu for ANT (script#155), it can be very powerful.
A few further suggestions on the ctags config file (things I've added to mine now):
(1) a pattern can also be (optionally) added for properties:
--regex-ant=/^[ \t]*<[ \t]*property.*name="([-.a-zA-Z0-9 ]+)".*>/\1/r,property/i
(2) Since almost any character can be used in an Ant name, I also modified the regex for the names to only exclude those characters that Ant won't allow:
--regex-ant=/^[ \t]*<[ \t]*project.*name="([^<"&]+)".*>/\1/p,project/i --regex-ant=/^[ \t]*<[ \t]*target.*name="([^<"&]+)".*>/\1/t,target/i --regex-ant=/^[ \t]*<[ \t]*property.*name="([^<"&]+)".*>/\1/r,property/i
Also, to use the property tags, change the tlist_ant_settings in the .vimrc to:
let g:tlist_ant_settings = 'ant;p:Project;t:Target;r:Property'
Since the xml tags sometimes cross multiple lines for formatting purposes I removed the closing > from the regexes
Now taglist.vim picks up all the targets.
Also if you want the ant properties to show up in the taglist window you need to
Thanks for the tip. Make sure your filetype is set to "ant". For me it was getting set to just "xml", so it took me sometime to figure out why the tags were not showing up.
I see the below warning from ctags when run on command-line:
ctags.exe: Warning: unknown regex flag: 'i' ctags.exe: Warning: unknown regex flag: 'i'
I am using the latest ctags (5.5.4) win32 exe. I tried the 5.5 cygwin exe as well, same warning. I looked at the man page and it seems to indicate "i" as a valid flag to mean case-insensitive. Anyone has a clue?