Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adds groovy support for vi

  • Loading branch information...
commit 4d17c3555bc01eb99efb46aaec692a0c3748eda0 1 parent 89978d5
Micah Breedlove authored
3  skel/DOT.vimrc
@@ -97,7 +97,7 @@
97 97 set listchars=extends:…,tab:\ \ ,trail:⌫
98 98 :filetype plugin on
99 99 :syntax on
100   -
  100 + au BufNewFile,BufRead *.groovy self groovy
101 101 au FileType php set omnifunc=phpcomplete#CompletePHP
102 102 let php_sql_query=1
103 103 let php_htmlInStrings=1
@@ -107,6 +107,7 @@
107 107 endif
108 108
109 109
  110 +
110 111 "------------------------------------------------------------------------------
111 112 " KEY MAPPINGS
112 113 "------------------------------------------------------------------------------
241 vim/plugins/groovy.vim
... ... @@ -0,0 +1,241 @@
  1 +" Vim filetype plugin file
  2 +"
  3 +" Language: Groovy
  4 +"
  5 +" Features: Runs or compiles Groovy scripts. Indents code blocks.
  6 +" Continues comments on adjacent lines. Provides
  7 +" insert-mode abbreviations. F2 for plugin help.
  8 +"
  9 +" Installation: Suggested installation at ~/.vim/ftplugin, or on Windows at
  10 +" <Vim install directory>\vimfiles\ftplugin.
  11 +" 'filetype plugin on' must be specified in .vimrc or _vimrc.
  12 +"
  13 +" Author: Jim Ruley <jimruley+vim@gmail.com>
  14 +"
  15 +" Date Created: April 20, 2008
  16 +"
  17 +" Version: 0.1.2
  18 +"
  19 +" Modification History:
  20 +"
  21 +" April 24, 2008: Properly reset modified indent when leaving
  22 +" buffer.
  23 +"
  24 +" April 23, 2008: Fixed mappings for F4 and F6, and replaced too
  25 +" restrictive cindent.
  26 +
  27 +if exists("b:did_ftplugin") | finish | endif
  28 +let b:did_ftplugin = 1
  29 +
  30 +" Make sure the continuation lines below do not cause problems in
  31 +" compatibility mode.
  32 +let s:save_cpo = &cpo
  33 +set cpo-=C
  34 +
  35 +" For filename completion, prefer .groovy extension over .class extension.
  36 +set suffixes+=.class
  37 +
  38 +" Set 'formatoptions' to break comment lines but not other lines,
  39 +" and insert the comment leader when hitting <CR> or using "o".
  40 +setlocal formatoptions-=t formatoptions+=croql
  41 +
  42 +" Set 'comments' to format dashed lists in comments. Behaves just like C.
  43 +setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
  44 +setlocal commentstring=//%s
  45 +
  46 +" Indent
  47 +setlocal smartindent
  48 +setlocal autoindent
  49 +
  50 +" Script variables
  51 +"
  52 +" Replace Windows backslashes, that would be swallowed in Cygwin, with slashes
  53 +let s:GROOVY_HOME = substitute($GROOVY_HOME, "\\", "/", "g")
  54 +let s:GROOVY_PATH = s:GROOVY_HOME . "/bin/groovy"
  55 +let s:GROOVYC_PATH = s:GROOVY_HOME . "/bin/groovyc"
  56 +let s:CLASSPATH_PROMPT = "Specify classpath, or hit Enter for none: "
  57 +let s:ARG_PROMPT = "Specify arg(s), or hit Enter for none: "
  58 +" Buffer variables
  59 +let b:classpath = ""
  60 +let b:args = ""
  61 +
  62 +" Prompt for classpath/args and run
  63 +if !exists("<SID>RunPrompt()")
  64 + function! <SID>RunPrompt()
  65 + update
  66 + silent cd %:p:h
  67 + if b:classpath == ""
  68 + let b:classpath = input(s:CLASSPATH_PROMPT)
  69 + else
  70 + let changeClasspath = input("Classpath = [". b:classpath . "] Change? (y or n) ")
  71 + if changeClasspath == "y"
  72 + let b:classpath = input(s:CLASSPATH_PROMPT)
  73 + endif
  74 + endif
  75 + if b:args == ""
  76 + let b:args = input(s:ARG_PROMPT)
  77 + else
  78 + let changeArgs = input("Arg(s) = [". b:args . "] Change? (y or n) ")
  79 + if changeArgs == "y"
  80 + let b:args = input(s:ARG_PROMPT)
  81 + endif
  82 + endif
  83 + if b:classpath == ""
  84 + if has("win32") || has("win64")
  85 + execute '!"' . s:GROOVY_PATH . '" ' . expand('%') . ' ' . b:args
  86 + else
  87 + execute "!" . s:GROOVY_PATH . " " . expand("%") . " " . b:args
  88 + endif
  89 + else
  90 + if has("win32") || has("win64")
  91 + execute '!"' . s:GROOVY_PATH . '" -cp ' . b:classpath . ' ' . expand('%') . ' ' . b:args
  92 + else
  93 + execute "!" . s:GROOVY_PATH . " -cp " . b:classpath . " " . expand("%") . " " . b:args
  94 + endif
  95 + endif
  96 + silent cd -
  97 + endfunction
  98 +endif
  99 +
  100 +" Prompt for classpath and compile
  101 +if !exists("<SID>CompilePrompt()")
  102 + function! <SID>CompilePrompt()
  103 + update
  104 + silent cd %:p:h
  105 + if b:classpath == ""
  106 + let b:classpath = input(s:CLASSPATH_PROMPT)
  107 + else
  108 + let changeClasspath = input("Classpath = [". b:classpath . "] Change? (y or n) ")
  109 + if changeClasspath == "y"
  110 + let b:classpath = input(s:CLASSPATH_PROMPT)
  111 + endif
  112 + endif
  113 + if b:classpath == ""
  114 + if has("win32") || has("win64")
  115 + execute '!"' . s:GROOVYC_PATH . '" ' . expand('%')
  116 + else
  117 + execute "!" . s:GROOVYC_PATH . " " . expand("%")
  118 + endif
  119 + else
  120 + if has("win32") || has("win64")
  121 + execute '!"' . s:GROOVYC_PATH . '" -cp ' . b:classpath . ' ' . expand('%')
  122 + else
  123 + execute "!" . s:GROOVYC_PATH . " -cp " . b:classpath . " " . expand("%")
  124 + endif
  125 + endif
  126 + silent cd -
  127 + endfunction
  128 +endif
  129 +
  130 +" Run with no classpath/args, or with the previously specified values
  131 +if !exists("<SID>RunNoPrompt()")
  132 + function! <SID>RunNoPrompt()
  133 + update
  134 + silent cd %:p:h
  135 + if b:classpath == ""
  136 + if has("win32") || has("win64")
  137 + execute '!"' . s:GROOVY_PATH . '" ' . expand("%") . ' ' . b:args
  138 + else
  139 + execute "!" . s:GROOVY_PATH . " " . expand("%") . " " . b:args
  140 + endif
  141 + else
  142 + if has("win32") || has("win64")
  143 + execute '!"' . s:GROOVY_PATH . '" -cp ' . b:classpath . ' ' . expand('%') . ' ' . b:args
  144 + else
  145 + execute "!" . s:GROOVY_PATH . " -cp " . b:classpath . " " . expand("%") . " " . b:args
  146 + endif
  147 + endif
  148 + silent cd -
  149 + endfunction
  150 +endif
  151 +
  152 +" Compile with no classpath, or with the previously specified value
  153 +if !exists("<SID>CompileNoPrompt()")
  154 + function! <SID>CompileNoPrompt()
  155 + update
  156 + silent cd %:p:h
  157 + if b:classpath == ""
  158 + if has("win32") || has("win64")
  159 + execute '!"' . s:GROOVYC_PATH . '" ' . expand('%')
  160 + else
  161 + execute "!" . s:GROOVYC_PATH . " " . expand("%")
  162 + endif
  163 + else
  164 + if has("win32") || has("win64")
  165 + execute '!"' . s:GROOVYC_PATH . '" -cp ' . b:classpath . ' ' . expand('%')
  166 + else
  167 + execute "!" . s:GROOVYC_PATH . " -cp " . b:classpath . " " . expand("%")
  168 + endif
  169 + endif
  170 + silent cd -
  171 + endfunction
  172 +endif
  173 +
  174 +" Display function key descriptions and abbreviations
  175 +if !exists("<SID>ShowHelp()")
  176 + function! <SID>ShowHelp()
  177 + echo "_____________________________________________________\n\nF3\tRun with prompt for classpath/arguments\nF4\tRun with no (or previous) classpath/arguments\n\nF5\tCompile with prompt for classpath\nF6\tCompile with no (or previous) classpath\n\nInsert Mode Abbreviations:\n\ncl\tclass declaration\ndcp\tdynamic classpath code\nfl\tfor loop\nfli\tfor loop with index\nifes\tif-else statement\nifs\tif statement\nmm\tmain method\npl\tprintln\nplg\tprintln with GString\npls\tprintln with string\nsf\tstatic final\nsw\tswitch statement\ntc\ttry-catch\ntcf\ttry-catch-finally\nwl\twhile loop\n "
  178 + endfunction
  179 +endif
  180 +
  181 +" Remove the space after an abbreviation
  182 +if !exists("<SID>RemoveSpace")
  183 + function! <SID>RemoveSpace()
  184 + let c = nr2char(getchar(0))
  185 + return (c =~ '\s') ? '' : c
  186 + endfunction
  187 +endif
  188 +
  189 +if !hasmapto("<SID>ShowHelp()", "n")
  190 + nmap <buffer><unique><silent> <F2> :call <SID>ShowHelp()<CR>
  191 +endif
  192 +if !hasmapto("<SID>RunPrompt()", "n")
  193 + nmap <buffer><unique><silent> <F3> :call <SID>RunPrompt()<CR>
  194 +endif
  195 +if !hasmapto("<SID>RunNoPrompt()")
  196 + nmap <buffer><unique><silent> <F4> :call <SID>RunNoPrompt()<CR>
  197 +endif
  198 +if !hasmapto("<SID>CompilePrompt()")
  199 + nmap <buffer><unique><silent> <F5> :call <SID>CompilePrompt()<CR>
  200 +endif
  201 +if !hasmapto("<SID>CompileNoPrompt()")
  202 + nmap <buffer><unique><silent> <F6> :call <SID>CompileNoPrompt()<CR>
  203 +endif
  204 +
  205 +" Display a help key reminder when first loading Vim (with a Groovy file)
  206 +au VimEnter *.groovy echo "F2 for Groovy plugin help"
  207 +
  208 +" Abbreviations
  209 +ia <buffer> cl class {<CR>}<Esc>kf{i<C-R>=<SID>RemoveSpace()<CR>
  210 +ia <buffer> dcp this.class.classLoader.rootLoader.addURL(new URL('file:///'))<Esc>F'i<C-R>=<SID>RemoveSpace()<CR>
  211 +ia <buffer> fl for( in ){<CR>}<Esc>kf(a<C-R>=<SID>RemoveSpace()<CR>
  212 +ia <buffer> fli for(int i = 0; i < ; i++){<CR>}<Esc>kf;f;i<C-R>=<SID>RemoveSpace()<CR>
  213 +ia <buffer> ifes if(){<CR>}else{<CR>}<Esc>kkf(a<C-R>=<SID>RemoveSpace()<CR>
  214 +ia <buffer> ifs if(){<CR>}<Esc>kf(a<C-R>=<SID>RemoveSpace()<CR>
  215 +ia <buffer> mm static main(args){<CR>}<Esc>kA<CR><Tab><C-R>=<SID>RemoveSpace()<CR>
  216 +ia <buffer> pl println <C-R>=<SID>RemoveSpace()<CR>
  217 +ia <buffer> plg println "${}"<Left><Left><C-R>=<SID>RemoveSpace()<CR>
  218 +ia <buffer> pls println ''<Left><C-R>=<SID>RemoveSpace()<CR>
  219 +ia <buffer> sf static final <C-R>=<SID>RemoveSpace()<CR>
  220 +ia <buffer> sw switch(){<CR>}<Esc>kf(a<C-R>=<SID>RemoveSpace()<CR>
  221 +ia <buffer> tc try{<CR>}catch(){<CR>}<Esc>kkA<CR><C-R>=<SID>RemoveSpace()<CR>
  222 +ia <buffer> tcf try{<CR>}catch(){<CR>}finally{<CR>}<Esc>kkkA<CR><C-R>=<SID>RemoveSpace()<CR>
  223 +ia <buffer> wl while(){<CR>}<Esc>kf(a<C-R>=<SID>RemoveSpace()<CR>
  224 +
  225 +" Change the :browse e filter to primarily show Groovy-related files.
  226 +if has("gui_win32") && !exists("b:browsefilter")
  227 + let b:browsefilter="Groovy Files (*.groovy)\t*.groovy\n" .
  228 + \ "Java Files (*.java)\t*.java\n" .
  229 + \ "GSP Files (*.gsp)\t*.gsp\n" .
  230 + \ "All Files (*.*)\t*.*\n"
  231 +endif
  232 +
  233 +" Undo the stuff we changed.
  234 +let b:undo_ftplugin = "setlocal suffixes< suffixesadd<" .
  235 + \ " formatoptions< comments< commentstring< path< includeexpr<" .
  236 + \ " smartindent<" .
  237 + \ " autoindent<" .
  238 + \ " | unlet! b:browsefilter"
  239 +
  240 +" Restore the saved compatibility options.
  241 +let &cpo = s:save_cpo
0  vim/snipMate.zip → vim/plugins/snipMate.zip
File renamed without changes
6 vim/scripts.vim
... ... @@ -0,0 +1,6 @@
  1 +if did_filetype()
  2 + finish
  3 +endif
  4 +if getline(1) =~ '^#!.*[/\\]groovy\>'
  5 + setf groovy
  6 +endif
450 vim/syntax/groovy.vim
... ... @@ -0,0 +1,450 @@
  1 +" Vim syntax file
  2 +" Language: Groovy
  3 +" Maintainer: Alessio Pace <billy.corgan@tiscali.it>
  4 +" Version: 0.1.9b
  5 +" URL: http://www.vim.org/scripts/script.php?script_id=945
  6 +" Last Change: 6/4/2004
  7 +
  8 +" This is my very first vim script, I hope to have
  9 +" done it the right way.
  10 +"
  11 +" I must directly or indirectly thank the author of java.vim and ruby.vim:
  12 +" I copied from them most of the stuff :-)
  13 +"
  14 +" Relies on html.vim
  15 +
  16 +" For version 5.x: Clear all syntax items
  17 +" For version 6.x: Quit when a syntax file was already loaded
  18 +"
  19 +" HOWTO USE IT (INSTALL):
  20 +" [groovy is still not recognized by vim! :-( ]
  21 +"
  22 +" 1) copy the file in the (global or user's $HOME/.vim/syntax/) syntax folder
  23 +"
  24 +" 2) add this line to recognize groovy files by filename extension:
  25 +"
  26 +" au BufNewFile,BufRead *.groovy setf groovy
  27 +" in the global vim filetype.vim file or inside $HOME/.vim/filetype.vim
  28 +"
  29 +" 3) add this part to recognize by content groovy script (no extension needed :-)
  30 +"
  31 +" if did_filetype()
  32 +" finish
  33 +" endif
  34 +" if getline(1) =~ '^#!.*[/\\]groovy\>'
  35 +" setf groovy
  36 +" endif
  37 +"
  38 +" in the global scripts.vim file or in $HOME/.vim/scripts.vim
  39 +"
  40 +" 4) open/write a .groovy file or a groovy script :-)
  41 +"
  42 +" Let me know if you like it or send me patches, so that I can improve it
  43 +" when I have time
  44 +
  45 +" Quit when a syntax file was already loaded
  46 +if !exists("main_syntax")
  47 + if version < 600
  48 + syntax clear
  49 + elseif exists("b:current_syntax")
  50 + finish
  51 + endif
  52 + " we define it here so that included files can test for it
  53 + let main_syntax='groovy'
  54 +endif
  55 +
  56 +" don't use standard HiLink, it will not work with included syntax files
  57 +if version < 508
  58 + command! -nargs=+ GroovyHiLink hi link <args>
  59 +else
  60 + command! -nargs=+ GroovyHiLink hi def link <args>
  61 +endif
  62 +
  63 +" ##########################
  64 +" Java stuff taken from java.vim
  65 +" some characters that cannot be in a groovy program (outside a string)
  66 +" syn match groovyError "[\\@`]"
  67 +"syn match groovyError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/"
  68 +"syn match groovyOK "\.\.\."
  69 +
  70 +" keyword definitions
  71 +syn keyword groovyExternal native package
  72 +syn match groovyExternal "\<import\(\s\+static\>\)\?"
  73 +syn keyword groovyError goto const
  74 +syn keyword groovyConditional if else switch
  75 +syn keyword groovyRepeat while for do
  76 +syn keyword groovyBoolean true false
  77 +syn keyword groovyConstant null
  78 +syn keyword groovyTypedef this super
  79 +syn keyword groovyOperator new instanceof
  80 +syn keyword groovyType boolean char byte short int long float double
  81 +syn keyword groovyType void
  82 +syn keyword groovyType Integer Double Date Boolean Float String Array Vector List
  83 +syn keyword groovyStatement return
  84 +syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable
  85 +syn keyword groovyExceptions throw try catch finally
  86 +syn keyword groovyAssert assert
  87 +syn keyword groovyMethodDecl synchronized throws
  88 +syn keyword groovyClassDecl extends implements interface
  89 +" to differentiate the keyword class from MyClass.class we use a match here
  90 +syn match groovyTypedef "\.\s*\<class\>"ms=s+1
  91 +syn keyword groovyClassDecl enum
  92 +syn match groovyClassDecl "^class\>"
  93 +syn match groovyClassDecl "[^.]\s*\<class\>"ms=s+1
  94 +syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite
  95 +syn match groovyUserLabelRef "\k\+" contained
  96 +syn keyword groovyScopeDecl public protected private abstract
  97 +
  98 +
  99 +if exists("groovy_highlight_groovy_lang_ids") || exists("groovy_highlight_groovy_lang") || exists("groovy_highlight_all")
  100 + " groovy.lang.*
  101 + syn keyword groovyLangClass Closure MetaMethod GroovyObject
  102 +
  103 + syn match groovyJavaLangClass "\<System\>"
  104 + syn keyword groovyJavaLangClass Cloneable Comparable Runnable Serializable Boolean Byte Class Object
  105 + syn keyword groovyJavaLangClass Character CharSequence ClassLoader Compiler
  106 + " syn keyword groovyJavaLangClass Integer Double Float Long
  107 + syn keyword groovyJavaLangClass InheritableThreadLocal Math Number Object Package Process
  108 + syn keyword groovyJavaLangClass Runtime RuntimePermission InheritableThreadLocal
  109 + syn keyword groovyJavaLangClass SecurityManager Short StrictMath StackTraceElement
  110 + syn keyword groovyJavaLangClass StringBuffer Thread ThreadGroup
  111 + syn keyword groovyJavaLangClass ThreadLocal Throwable Void ArithmeticException
  112 + syn keyword groovyJavaLangClass ArrayIndexOutOfBoundsException AssertionError
  113 + syn keyword groovyJavaLangClass ArrayStoreException ClassCastException
  114 + syn keyword groovyJavaLangClass ClassNotFoundException
  115 + syn keyword groovyJavaLangClass CloneNotSupportedException Exception
  116 + syn keyword groovyJavaLangClass IllegalAccessException
  117 + syn keyword groovyJavaLangClass IllegalArgumentException
  118 + syn keyword groovyJavaLangClass IllegalMonitorStateException
  119 + syn keyword groovyJavaLangClass IllegalStateException
  120 + syn keyword groovyJavaLangClass IllegalThreadStateException
  121 + syn keyword groovyJavaLangClass IndexOutOfBoundsException
  122 + syn keyword groovyJavaLangClass InstantiationException InterruptedException
  123 + syn keyword groovyJavaLangClass NegativeArraySizeException NoSuchFieldException
  124 + syn keyword groovyJavaLangClass NoSuchMethodException NullPointerException
  125 + syn keyword groovyJavaLangClass NumberFormatException RuntimeException
  126 + syn keyword groovyJavaLangClass SecurityException StringIndexOutOfBoundsException
  127 + syn keyword groovyJavaLangClass UnsupportedOperationException
  128 + syn keyword groovyJavaLangClass AbstractMethodError ClassCircularityError
  129 + syn keyword groovyJavaLangClass ClassFormatError Error ExceptionInInitializerError
  130 + syn keyword groovyJavaLangClass IllegalAccessError InstantiationError
  131 + syn keyword groovyJavaLangClass IncompatibleClassChangeError InternalError
  132 + syn keyword groovyJavaLangClass LinkageError NoClassDefFoundError
  133 + syn keyword groovyJavaLangClass NoSuchFieldError NoSuchMethodError
  134 + syn keyword groovyJavaLangClass OutOfMemoryError StackOverflowError
  135 + syn keyword groovyJavaLangClass ThreadDeath UnknownError UnsatisfiedLinkError
  136 + syn keyword groovyJavaLangClass UnsupportedClassVersionError VerifyError
  137 + syn keyword groovyJavaLangClass VirtualMachineError
  138 +
  139 + syn keyword groovyJavaLangObject clone equals finalize getClass hashCode
  140 + syn keyword groovyJavaLangObject notify notifyAll toString wait
  141 +
  142 + GroovyHiLink groovyLangClass groovyConstant
  143 + GroovyHiLink groovyJavaLangClass groovyExternal
  144 + GroovyHiLink groovyJavaLangObject groovyConstant
  145 + syn cluster groovyTop add=groovyJavaLangObject,groovyJavaLangClass,groovyLangClass
  146 + syn cluster groovyClasses add=groovyJavaLangClass,groovyLangClass
  147 +endif
  148 +
  149 +
  150 +" Groovy stuff
  151 +syn match groovyOperator "\.\."
  152 +syn match groovyOperator "<\{2,3}"
  153 +syn match groovyOperator ">\{2,3}"
  154 +syn match groovyOperator "->"
  155 +syn match groovyExternal '^#!.*[/\\]groovy\>'
  156 +syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
  157 +
  158 +" Groovy JDK stuff
  159 +syn keyword groovyJDKBuiltin as def in
  160 +syn keyword groovyJDKOperOverl div minus plus abs round power multiply
  161 +syn keyword groovyJDKMethods each call inject sort print println
  162 +syn keyword groovyJDKMethods getAt putAt size push pop toList getText writeLine eachLine readLines
  163 +syn keyword groovyJDKMethods withReader withStream withWriter withPrintWriter write read leftShift
  164 +syn keyword groovyJDKMethods withWriterAppend readBytes splitEachLine
  165 +syn keyword groovyJDKMethods newInputStream newOutputStream newPrintWriter newReader newWriter
  166 +syn keyword groovyJDKMethods compareTo next previous isCase
  167 +syn keyword groovyJDKMethods times step toInteger upto any collect dump every find findAll grep
  168 +syn keyword groovyJDKMethods inspect invokeMethods join
  169 +syn keyword groovyJDKMethods getErr getIn getOut waitForOrKill
  170 +syn keyword groovyJDKMethods count tokenize asList flatten immutable intersect reverse reverseEach
  171 +syn keyword groovyJDKMethods subMap append asWritable eachByte eachLine eachFile
  172 +syn cluster groovyTop add=groovyJDKBuiltin,groovyJDKOperOverl,groovyJDKMethods
  173 +
  174 +" no useful I think, so I comment it..
  175 +"if filereadable(expand("<sfile>:p:h")."/groovyid.vim")
  176 + " source <sfile>:p:h/groovyid.vim
  177 +"endif
  178 +
  179 +if exists("groovy_space_errors")
  180 + if !exists("groovy_no_trail_space_error")
  181 + syn match groovySpaceError "\s\+$"
  182 + endif
  183 + if !exists("groovy_no_tab_space_error")
  184 + syn match groovySpaceError " \+\t"me=e-1
  185 + endif
  186 +endif
  187 +
  188 +" it is a better case construct than java.vim to match groovy syntax
  189 +syn region groovyLabelRegion transparent matchgroup=groovyLabel start="\<case\>" matchgroup=NONE end=":\|$" contains=groovyNumber,groovyString,groovyLangClass,groovyJavaLangClass
  190 +syn match groovyUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=groovyLabel
  191 +syn keyword groovyLabel default
  192 +
  193 +if !exists("groovy_allow_cpp_keywords")
  194 + syn keyword groovyError auto delete extern friend inline redeclared
  195 + syn keyword groovyError register signed sizeof struct template typedef union
  196 + syn keyword groovyError unsigned operator
  197 +endif
  198 +
  199 +" The following cluster contains all groovy groups except the contained ones
  200 +syn cluster groovyTop add=groovyExternal,groovyError,groovyError,groovyBranch,groovyLabelRegion,groovyLabel,groovyConditional,groovyRepeat,groovyBoolean,groovyConstant,groovyTypedef,groovyOperator,groovyType,groovyType,groovyStatement,groovyStorageClass,groovyAssert,groovyExceptions,groovyMethodDecl,groovyClassDecl,groovyClassDecl,groovyClassDecl,groovyScopeDecl,groovyError,groovyError2,groovyUserLabel,groovyLangObject
  201 +
  202 +
  203 +" Comments
  204 +syn keyword groovyTodo contained TODO FIXME XXX
  205 +if exists("groovy_comment_strings")
  206 + syn region groovyCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=groovySpecial,groovyCommentStar,groovySpecialChar,@Spell
  207 + syn region groovyComment2String contained start=+"+ end=+$\|"+ contains=groovySpecial,groovySpecialChar,@Spell
  208 + syn match groovyCommentCharacter contained "'\\[^']\{1,6\}'" contains=groovySpecialChar
  209 + syn match groovyCommentCharacter contained "'\\''" contains=groovySpecialChar
  210 + syn match groovyCommentCharacter contained "'[^\\]'"
  211 + syn cluster groovyCommentSpecial add=groovyCommentString,groovyCommentCharacter,groovyNumber
  212 + syn cluster groovyCommentSpecial2 add=groovyComment2String,groovyCommentCharacter,groovyNumber
  213 +endif
  214 +syn region groovyComment start="/\*" end="\*/" contains=@groovyCommentSpecial,groovyTodo,@Spell
  215 +syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1
  216 +syn match groovyCommentStar contained "^\s*\*$"
  217 +syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
  218 +syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
  219 +GroovyHiLink groovyCommentString groovyString
  220 +GroovyHiLink groovyComment2String groovyString
  221 +GroovyHiLink groovyCommentCharacter groovyCharacter
  222 +
  223 +syn cluster groovyTop add=groovyComment,groovyLineComment
  224 +
  225 +if !exists("groovy_ignore_groovydoc") && main_syntax != 'jsp'
  226 + syntax case ignore
  227 + " syntax coloring for groovydoc comments (HTML)
  228 + " syntax include @groovyHtml <sfile>:p:h/html.vim
  229 + syntax include @groovyHtml runtime! syntax/html.vim
  230 + unlet b:current_syntax
  231 + syn region groovyDocComment start="/\*\*" end="\*/" keepend contains=groovyCommentTitle,@groovyHtml,groovyDocTags,groovyTodo,@Spell
  232 + syn region groovyCommentTitle contained matchgroup=groovyDocComment start="/\*\*" matchgroup=groovyCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@groovyHtml,groovyCommentStar,groovyTodo,@Spell,groovyDocTags
  233 +
  234 + syn region groovyDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}"
  235 + syn match groovyDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" contains=groovyDocParam
  236 + syn match groovyDocParam contained "\s\S\+"
  237 + syn match groovyDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>"
  238 + syntax case match
  239 +endif
  240 +
  241 +" match the special comment /**/
  242 +syn match groovyComment "/\*\*/"
  243 +
  244 +" Strings and constants
  245 +syn match groovySpecialError contained "\\."
  246 +syn match groovySpecialCharError contained "[^']"
  247 +syn match groovySpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)"
  248 +syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
  249 +syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
  250 +" syn region groovyELExpr start=+${+ end=+}+ keepend contained
  251 + syn match groovyELExpr /\${.\{-}}/ contained
  252 +GroovyHiLink groovyELExpr Identifier
  253 +
  254 +" TODO: better matching. I am waiting to understand how it really works in groovy
  255 +" syn region groovyClosureParamsBraces start=+|+ end=+|+ contains=groovyClosureParams
  256 +" syn match groovyClosureParams "[ a-zA-Z0-9_*]\+" contained
  257 +" GroovyHiLink groovyClosureParams Identifier
  258 +
  259 +" next line disabled, it can cause a crash for a long line
  260 +"syn match groovyStringError +"\([^"\\]\|\\.\)*$+
  261 +
  262 +" disabled: in groovy strings or characters are written the same
  263 +" syn match groovyCharacter "'[^']*'" contains=groovySpecialChar,groovySpecialCharError
  264 +" syn match groovyCharacter "'\\''" contains=groovySpecialChar
  265 +" syn match groovyCharacter "'[^\\]'"
  266 +syn match groovyNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
  267 +syn match groovyNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
  268 +syn match groovyNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
  269 +syn match groovyNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
  270 +
  271 +" unicode characters
  272 +syn match groovySpecial "\\u\d\{4\}"
  273 +
  274 +syn cluster groovyTop add=groovyString,groovyCharacter,groovyNumber,groovySpecial,groovyStringError
  275 +
  276 +if exists("groovy_highlight_functions")
  277 + if groovy_highlight_functions == "indent"
  278 + syn match groovyFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
  279 + syn region groovyFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
  280 + syn match groovyFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
  281 + syn region groovyFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
  282 + else
  283 + " This line catches method declarations at any indentation>0, but it assumes
  284 + " two things:
  285 + " 1. class names are always capitalized (ie: Button)
  286 + " 2. method names are never capitalized (except constructors, of course)
  287 + syn region groovyFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,groovyComment,groovyLineComment,@groovyClasses
  288 + endif
  289 + syn match groovyBraces "[{}]"
  290 + syn cluster groovyTop add=groovyFuncDef,groovyBraces
  291 +endif
  292 +
  293 +if exists("groovy_highlight_debug")
  294 +
  295 + " Strings and constants
  296 + syn match groovyDebugSpecial contained "\\\d\d\d\|\\."
  297 + syn region groovyDebugString contained start=+"+ end=+"+ contains=groovyDebugSpecial
  298 + syn match groovyDebugStringError +"\([^"\\]\|\\.\)*$+
  299 + syn match groovyDebugCharacter contained "'[^\\]'"
  300 + syn match groovyDebugSpecialCharacter contained "'\\.'"
  301 + syn match groovyDebugSpecialCharacter contained "'\\''"
  302 + syn match groovyDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
  303 + syn match groovyDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
  304 + syn match groovyDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
  305 + syn match groovyDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
  306 + syn keyword groovyDebugBoolean contained true false
  307 + syn keyword groovyDebugType contained null this super
  308 + syn region groovyDebugParen start=+(+ end=+)+ contained contains=groovyDebug.*,groovyDebugParen
  309 +
  310 + " to make this work you must define the highlighting for these groups
  311 + syn match groovyDebug "\<System\.\(out\|err\)\.print\(ln\)*\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
  312 + syn match groovyDebug "\<p\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
  313 + syn match groovyDebug "[A-Za-z][a-zA-Z0-9_]*\.printStackTrace\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
  314 + syn match groovyDebug "\<trace[SL]\=\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
  315 +
  316 + syn cluster groovyTop add=groovyDebug
  317 +
  318 + if version >= 508 || !exists("did_c_syn_inits")
  319 + GroovyHiLink groovyDebug Debug
  320 + GroovyHiLink groovyDebugString DebugString
  321 + GroovyHiLink groovyDebugStringError groovyError
  322 + GroovyHiLink groovyDebugType DebugType
  323 + GroovyHiLink groovyDebugBoolean DebugBoolean
  324 + GroovyHiLink groovyDebugNumber Debug
  325 + GroovyHiLink groovyDebugSpecial DebugSpecial
  326 + GroovyHiLink groovyDebugSpecialCharacter DebugSpecial
  327 + GroovyHiLink groovyDebugCharacter DebugString
  328 + GroovyHiLink groovyDebugParen Debug
  329 +
  330 + GroovyHiLink DebugString String
  331 + GroovyHiLink DebugSpecial Special
  332 + GroovyHiLink DebugBoolean Boolean
  333 + GroovyHiLink DebugType Type
  334 + endif
  335 +endif
  336 +
  337 +" Match all Exception classes
  338 +syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
  339 +
  340 +
  341 +if !exists("groovy_minlines")
  342 + let groovy_minlines = 10
  343 +endif
  344 +exec "syn sync ccomment groovyComment minlines=" . groovy_minlines
  345 +
  346 +
  347 +" ###################
  348 +" Groovy stuff
  349 +" syn match groovyOperator "|[ ,a-zA-Z0-9_*]\+|"
  350 +
  351 +" All groovy valid tokens
  352 +" syn match groovyTokens ";\|,\|<=>\|<>\|:\|:=\|>\|>=\|=\|==\|<\|<=\|!=\|/\|/=\|\.\.|\.\.\.\|\~=\|\~=="
  353 +" syn match groovyTokens "\*=\|&\|&=\|\*\|->\|\~\|+\|-\|/\|?\|<<<\|>>>\|<<\|>>"
  354 +
  355 +" Must put explicit these ones because groovy.vim mark them as errors otherwise
  356 +" syn match groovyTokens "<=>\|<>\|==\~"
  357 +"syn cluster groovyTop add=groovyTokens
  358 +
  359 +" Mark these as operators
  360 +
  361 +" Hightlight brackets
  362 +" syn match groovyBraces "[{}]"
  363 +" syn match groovyBraces "[\[\]]"
  364 +" syn match groovyBraces "[\|]"
  365 +
  366 +if exists("groovy_mark_braces_in_parens_as_errors")
  367 + syn match groovyInParen contained "[{}]"
  368 + GroovyHiLink groovyInParen groovyError
  369 + syn cluster groovyTop add=groovyInParen
  370 +endif
  371 +
  372 +" catch errors caused by wrong parenthesis
  373 +syn region groovyParenT transparent matchgroup=groovyParen start="(" end=")" contains=@groovyTop,groovyParenT1
  374 +syn region groovyParenT1 transparent matchgroup=groovyParen1 start="(" end=")" contains=@groovyTop,groovyParenT2 contained
  375 +syn region groovyParenT2 transparent matchgroup=groovyParen2 start="(" end=")" contains=@groovyTop,groovyParenT contained
  376 +syn match groovyParenError ")"
  377 +GroovyHiLink groovyParenError groovyError
  378 +
  379 +" catch errors caused by wrong square parenthesis
  380 +syn region groovyParenT transparent matchgroup=groovyParen start="\[" end="\]" contains=@groovyTop,groovyParenT1
  381 +syn region groovyParenT1 transparent matchgroup=groovyParen1 start="\[" end="\]" contains=@groovyTop,groovyParenT2 contained
  382 +syn region groovyParenT2 transparent matchgroup=groovyParen2 start="\[" end="\]" contains=@groovyTop,groovyParenT contained
  383 +syn match groovyParenError "\]"
  384 +
  385 +" ###############################
  386 +" java.vim default highlighting
  387 +if version >= 508 || !exists("did_groovy_syn_inits")
  388 + if version < 508
  389 + let did_groovy_syn_inits = 1
  390 + endif
  391 + GroovyHiLink groovyFuncDef Function
  392 + GroovyHiLink groovyBraces Function
  393 + GroovyHiLink groovyBranch Conditional
  394 + GroovyHiLink groovyUserLabelRef groovyUserLabel
  395 + GroovyHiLink groovyLabel Label
  396 + GroovyHiLink groovyUserLabel Label
  397 + GroovyHiLink groovyConditional Conditional
  398 + GroovyHiLink groovyRepeat Repeat
  399 + GroovyHiLink groovyExceptions Exception
  400 + GroovyHiLink groovyAssert Statement
  401 + GroovyHiLink groovyStorageClass StorageClass
  402 + GroovyHiLink groovyMethodDecl groovyStorageClass
  403 + GroovyHiLink groovyClassDecl groovyStorageClass
  404 + GroovyHiLink groovyScopeDecl groovyStorageClass
  405 + GroovyHiLink groovyBoolean Boolean
  406 + GroovyHiLink groovySpecial Special
  407 + GroovyHiLink groovySpecialError Error
  408 + GroovyHiLink groovySpecialCharError Error
  409 + GroovyHiLink groovyString String
  410 + GroovyHiLink groovyCharacter Character
  411 + GroovyHiLink groovySpecialChar SpecialChar
  412 + GroovyHiLink groovyNumber Number
  413 + GroovyHiLink groovyError Error
  414 + GroovyHiLink groovyStringError Error
  415 + GroovyHiLink groovyStatement Statement
  416 + GroovyHiLink groovyOperator Operator
  417 + GroovyHiLink groovyComment Comment
  418 + GroovyHiLink groovyDocComment Comment
  419 + GroovyHiLink groovyLineComment Comment
  420 + GroovyHiLink groovyConstant Constant
  421 + GroovyHiLink groovyTypedef Typedef
  422 + GroovyHiLink groovyTodo Todo
  423 +
  424 + GroovyHiLink groovyCommentTitle SpecialComment
  425 + GroovyHiLink groovyDocTags Special
  426 + GroovyHiLink groovyDocParam Function
  427 + GroovyHiLink groovyCommentStar groovyComment
  428 +
  429 + GroovyHiLink groovyType Type
  430 + GroovyHiLink groovyExternal Include
  431 +
  432 + GroovyHiLink htmlComment Special
  433 + GroovyHiLink htmlCommentPart Special
  434 + GroovyHiLink groovySpaceError Error
  435 + GroovyHiLink groovyJDKBuiltin Special
  436 + GroovyHiLink groovyJDKOperOverl Operator
  437 + GroovyHiLink groovyJDKMethods Function
  438 +endif
  439 +
  440 +delcommand GroovyHiLink
  441 +
  442 +
  443 +let b:current_syntax = "groovy"
  444 +if main_syntax == 'groovy'
  445 + unlet main_syntax
  446 +endif
  447 +
  448 +let b:spell_options="contained"
  449 +
  450 +" vim: ts=8
0  vim/javacomplete0.77.1.2.zip → vim/syntax/javacomplete0.77.1.2.zip
File renamed without changes

0 comments on commit 4d17c35

Please sign in to comment.
Something went wrong with that request. Please try again.