In my IDE (webstorm) I have configured an external tool to run ant like so:
ant myTarget -DfileNoExt="$FileNameWithoutExtension$"
the $FileNameWithoutExtension$ is expanded by the IDE when the command is run.
I am transitioning to using Vim. I am a Vim n00b.
How do I do the same with Vim (MacVim specifically)?
Vim will expand
%as the current file. You can use modifiers on it (see:help filename-modifiers). You can tell vim to use ant as your make program:Now you can use
:maketo build your current file. You should get build errors in your quickfix (view it with:copen).You probably want to put the above script into a file
~/.vim/after/ftplugin/java.vim. That will load it for every java file you open.Note that if you want to use different targets,
:makewill pass all arguments to ant. So:make otherTargetwill executeant myTarget -DfileNoExt="file" otherTarget.