diff --git a/after/syntax/groovy.vim b/after/syntax/groovy.vim deleted file mode 100644 index 8f18d23..0000000 --- a/after/syntax/groovy.vim +++ /dev/null @@ -1,11 +0,0 @@ -" File: groovy.vim -" Author: Kenneth Benzie (Benie) -" Description: Extended groovy syntax for Jenkins DSL. - -" Highlight shell('') and shell('''''') blocks with the sh filetype. -syn include @groovyHighlightSh syntax/sh.vim -syn region groovyHighlightSh matchgroup=groovyString start="shell(\zs'\(''\)\=" end="\(''\)\='\ze)" contains=@groovyHighlightSh - -" Highlight batchFile('') and batchFile('''''') blocks with the batch filetype. -syn include @groovyHighlightBatch syntax/batch.vim -syn region groovyHighlightBatch matchgroup=groovyString start="batchFile(\zs'\(''\)\=" end="\(''\)\='\ze)" contains=@groovyHighlightBatch diff --git a/syntax/groovy.vim b/syntax/groovy.vim new file mode 100644 index 0000000..fe61f91 --- /dev/null +++ b/syntax/groovy.vim @@ -0,0 +1,72 @@ +" File: groovy.vim +" Author: Kenneth Benzie (Benie) +" Description: Extended groovy syntax for Jenkins DSL. + +" Highlight shell('') and shell('''''') blocks with the sh filetype. +" unlet !b:current_syntax + +" Highlight batchFile('') and batchFile('''''') blocks with the batch filetype. +" syn include @groovyHighlightBatch syntax/batch.vim +" syn region groovyHighlightBatch matchgroup=groovyString start="batchFile(\zs'\(''\)\=" end="\(''\)\='\ze)" contains=@groovyHighlightBatch + +" keyword definitions +" syn keyword groovyExternal native package +" syn match groovyExternal "\\(\s\+static\>\)\?" +" syn keyword groovyError goto const +" syn keyword groovyConditional if else switch +" syn keyword groovyRepeat while for do +" syn keyword groovyBoolean true false +" syn keyword groovyConstant null +" syn keyword groovyTypedef this super +" syn keyword groovyOperator new instanceof +" syn keyword groovyType boolean char byte short int long float double void +" \ Integer Double Date Boolean Float String Array Vector List +" syn keyword groovyStatement return +" syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable +" syn keyword groovyExceptions throw try catch finally +" syn keyword groovyAssert assert +" syn keyword groovyMethodDecl synchronized throws +" syn keyword groovyClassDecl extends implements interface +" " to differentiate the keyword class from MyClass.class we use a match here +" syn match groovyTypedef "\.\s*\"ms=s+1 +" syn keyword groovyClassDecl enum +" syn match groovyClassDecl "^class\>" +" syn match groovyClassDecl "[^.]\s*\"ms=s+1 +" syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite +" syn match groovyUserLabelRef "\k\+" contained +" syn keyword groovyScopeDecl public protected private abstract + +syn region groovyComment start='\/\*' end='\*\/' fold +syn match groovyComment '\s*\/\/.*$' + +syn match groovyDelimiter '[()\[\]]' +syn region groovyBlock matchgroup=groovyDelimiter start='{' end='}' transparent fold + +syn match groovyStructure '\w\+\ze\s*{' +syn match groovyFunction '\w\+\ze\s*(' + +syn region groovyIdentifier start='${' end='}' oneline +syn region groovyString start=+"+ end=+"+ oneline contains=groovyIdentifier +syn region groovyString start=+'+ end=+'+ oneline contains=groovyIdentifier +syn region groovyString start=+'''+ end=+'''+ fold contains=groovyIdentifier + +syn include @groovyShellSyntax syntax/sh.vim +unlet b:current_syntax +syn region groovyShellSyntax matchgroup=groovyString start=+'''+ end=+'''+ contains=@groovyShellSyntax contained +syn region groovyShell matchgroup=groovyFunction start='shell\s*\ze(' end='\ze)' fold contains=groovyShellSyntax,groovyDelimiter + +syn include @groovyBatchSyntax syntax/dosbatch.vim +unlet b:current_syntax +syn region groovyBatchSyntax matchgroup=groovyString start=+'''+ end=+'''+ contains=@groovyBatchSyntax contained +syn region groovyBatch matchgroup=groovyFunction start='batchFile\s*\ze(' end='\ze)' fold contains=groovyBatchSyntax,groovyDelimiter + +hi default link groovyDelimiter Delimiter +hi default link groovyBoolean Boolean +hi default link groovyComment Comment +hi default link groovyString String +hi default link groovyStructure Structure +hi default link groovyIdentifier Identifier +hi default link groovyFunction Function +hi default link groovyShellDelimiter groovyDelimiter + +let b:current_syntax = 'groovy'