First a bit of context for those who don't know gradle. It's basically like make except that you don't have to have gradle installed on your computer. It ships with projects as a file called gradlew. So for instance a gradle project could look like:. gradlew src     main         java             com                 foo                     bar                         Bar.java                         Baz.java                         Foo.java                         Qux.javaAnd from the root directory I can run commands like ./gradlew build or ./gradlew test to build/test my code.Now vim. First I :set autochdir in my .vimrc. Second, my current buffer is Foo.java.I want to run :make which would trigger ../../../../../../gradlew. How can I set makeprg such that no matter what's my :pwd it'll call gradlew (I guess that could be achieved using dirname in a loop but I'm not sure if that's the most efficient/cleanest way to do that).Thanks.
Set makeprg to gradlew
vim;compiling
For those looking to do the same thing (or similar things), it's doable by creating a new compiler that use findfile, and reuse errorformat from some other compiler + slight modifications. The end result looks like:let s:gradlew = escape(findfile('gradlew', '.;') .  -b  . findfile('build.gradle', '.;'), ' \')if exists(current_compiler)    finishendifif exists(:CompilerSet) != 2       older Vim always used :setlocal  command -nargs=* CompilerSet setlocal <args>endiflet current_compiler = s:gradlewexecute CompilerSet makeprg= . s:gradlew copied from javac.vim + added the :compileJava bitsCompilerSet errorformat=%E:compileJava%f:%l:\ %m,%E%f:%l:\ %m,%-Z%p^,%-C%.%#,%-G%.%#