I'm trying to add auto-completion for some custom ant parameters. However, it seems to be overwriting the existing oh my zsh ant plugin auto-completions which I'd like to keep. Is there a simple way to have both the oh my zsh plugin and my custom ant auto-completion live in harmony?
Here's the existing plugin at ~/.oh-my-zsh/plugins/ant/ant.plugin.zsh
_ant_does_target_list_need_generating () {
[ ! -f .ant_targets ] && return 0;
[ build.xml -nt .ant_targets ] && return 0;
return 1;
}
_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
fi
compadd -- `cat .ant_targets`
fi
}
compdef _ant ant
And my auto complete at ~/my_completions/_ant
#compdef ant
_arguments '-Dprop=-[properties file]:filename:->files' '-Dsrc=-[build directory]:directory:_files -/'
case "$state" in
files)
local -a property_files
property_files=( *.properties )
_multi_parts / property_files
;;
esac
And here is my $fpath
, the path for my completion is earlier in the list which I guess is why my script gets precedence.
/Users/myusername/my_completions /Users/myusername/.oh-my-zsh/plugins/git /Users/myusername/.oh-my-zsh/functions /Users/myusername/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.0.8/functions