From 1ba88cc7d8abdd934bd67407d9127ba38568ccf6 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 4 Mar 2019 10:57:25 +0100 Subject: [PATCH] Add gradle compiler support, closes #358 --- README.md | 3 ++- build | 1 + compiler/gradle.vim | 28 ++++++++++++++++++++++++++++ compiler/gradlew.vim | 28 ++++++++++++++++++++++++++++ ftdetect/polyglot.vim | 8 ++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 compiler/gradle.vim create mode 100644 compiler/gradlew.vim diff --git a/README.md b/README.md index 07a5495..2d30b10 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A collection of language packs for Vim. > One to rule them all, one to find them, one to bring them all and in the darkness bind them. - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 100+ times faster** than the 126 packages it consists of. +- It **installs and updates 100+ times faster** than the 127 packages it consists of. - Solid syntax and indentation support (other features skipped). Only the best language packs. - All unnecessary files are ignored (like enormous documentation from php support). - No support for esoteric languages, only most popular ones (modern too, like `slim`). @@ -79,6 +79,7 @@ If you need full functionality of any plugin, please use it directly with your p - [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax) - [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax) - [go](https://github.com/fatih/vim-go) (syntax, compiler, indent) +- [gradle](https://github.com/tfnico/vim-gradle) (compiler) - [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, ftplugin) - [groovy-indent](https://github.com/vim-scripts/groovyindent-unix) (indent) - [groovy](https://github.com/vim-scripts/groovy.vim) (syntax) diff --git a/build b/build index 9b55a01..387dd2e 100755 --- a/build +++ b/build @@ -187,6 +187,7 @@ PACKS=" gmpl:maelvalais/gmpl.vim gnuplot:vim-scripts/gnuplot-syntax-highlighting go:fatih/vim-go:_BASIC + gradle:tfnico/vim-gradle graphql:jparise/vim-graphql groovy:vim-scripts/groovy.vim groovy-indent:vim-scripts/groovyindent-unix diff --git a/compiler/gradle.vim b/compiler/gradle.vim new file mode 100644 index 0000000..4d867c8 --- /dev/null +++ b/compiler/gradle.vim @@ -0,0 +1,28 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'gradle') != -1 + finish +endif + +" Vim Compiler File +" Compiler: gradle + +if exists("current_compiler") + finish +endif +let current_compiler = "gradle" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=gradle + +CompilerSet errorformat= + \%E[ant:scalac]\ %f:%l:\ error:\ %m, + \%W[ant:scalac]\ %f:%l:\ warning:\ %m, + \%E%.%#:compile%\\w%#Java%f:%l:\ error:\ %m,%-Z%p^,%-C%.%#, + \%W%.%#:compile%\\w%#Java%f:%l:\ warning:\ %m,%-Z%p^,%-C%.%#, + \%E%f:%l:\ error:\ %m,%-Z%p^,%-C%.%#, + \%W%f:%l:\ warning:\ %m,%-Z%p^,%-C%.%#, + \%E%f:\ %\\d%\\+:\ %m\ @\ line\ %l\\,\ column\ %c.,%-C%.%#,%Z%p^, + \%E%>%f:\ %\\d%\\+:\ %m,%C\ @\ line\ %l\\,\ column\ %c.,%-C%.%#,%Z%p^, + \%-G%.%# diff --git a/compiler/gradlew.vim b/compiler/gradlew.vim new file mode 100644 index 0000000..aeb73ea --- /dev/null +++ b/compiler/gradlew.vim @@ -0,0 +1,28 @@ +if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'gradle') != -1 + finish +endif + +" Vim Compiler File +" Compiler: gradlew + +if exists("current_compiler") + finish +endif +let current_compiler = "gradlew" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=./gradlew + +CompilerSet errorformat= + \%E[ant:scalac]\ %f:%l:\ error:\ %m, + \%W[ant:scalac]\ %f:%l:\ warning:\ %m, + \%E%.%#:compile%\\w%#Java%f:%l:\ error:\ %m,%-Z%p^,%-C%.%#, + \%W%.%#:compile%\\w%#Java%f:%l:\ warning:\ %m,%-Z%p^,%-C%.%#, + \%E%f:%l:\ error:\ %m,%-Z%p^,%-C%.%#, + \%W%f:%l:\ warning:\ %m,%-Z%p^,%-C%.%#, + \%E%f:\ %\\d%\\+:\ %m\ @\ line\ %l\\,\ column\ %c.,%-C%.%#,%Z%p^, + \%E%>%f:\ %\\d%\\+:\ %m,%C\ @\ line\ %l\\,\ column\ %c.,%-C%.%#,%Z%p^, + \%-G%.%# diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 5dc3b47..3316c3b 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -427,6 +427,14 @@ unlet s:cpo_save augroup end endif +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gradle') == -1 + augroup filetypedetect + " gradle, from gradle.vim in tfnico/vim-gradle +" gradle syntax highlighting +au BufNewFile,BufRead *.gradle set filetype=groovy + augroup end +endif + if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 augroup filetypedetect " graphql, from graphql.vim in jparise/vim-graphql