major cleanup and reindent

This commit is contained in:
Jose Elera Campana
2013-09-17 23:10:06 -05:00
parent 632a1de4df
commit e98aa68678

View File

@@ -37,7 +37,7 @@ syntax sync fromstart
syn match shebang "^#!.*"
hi link shebang Comment
"" Programm Keywords"{{{
" Statement Keywords {{{
syntax keyword javaScriptSource import export
syntax keyword javaScriptIdentifier arguments this let var void yield
syntax keyword javaScriptOperator delete new instanceof typeof
@@ -46,27 +46,23 @@ syntax keyword javaScriptNull null undefined
syntax keyword javaScriptMessage alert confirm prompt status
syntax keyword javaScriptGlobal self top parent
syntax keyword javaScriptDeprecated escape unescape all applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding
"}}}
"" Statement Keywords"{{{
syntax keyword javaScriptConditional if else switch
syntax keyword javaScriptRepeat do while for in
syntax keyword javaScriptBranch break continue
syntax keyword javaScriptLabel case default
syntax keyword javaScriptPrototype prototype
syntax keyword javaScriptStatement return with
syntax keyword javaScriptGlobalObjects Array Boolean Date Function Math Number Object RegExp String
syntax keyword javaScriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
syntax keyword javaScriptReserved abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
"}}}
"" JavaScript comments"{{{
" Comments {{{
syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
"}}}
" JSDoc support start"{{{
" JSDoc support {{{
if !exists("javascript_ignore_javaScriptdoc")
syntax case ignore
@@ -82,9 +78,8 @@ if !exists("javascript_ignore_javaScriptdoc")
syntax case match
endif
syntax case match
" JSDoc Support end }}}
"" Syntax in the JavaScript code"{{{
"}}}
" Strings, Numbers and Regex Highlight {{{
syn match javaScriptSpecial "\\\d\d\d\|\\."
syn region javaScriptString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
syn region javaScriptString start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
@@ -92,17 +87,7 @@ if !exists("javascript_ignore_javaScriptdoc")
syn match javaScriptSpecialCharacter "'\\.'"
syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gim]\{0,2\}\s*$+ end=+/[gim]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
" syntax match javaScriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
" syntax region javaScriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=javaScriptSpecial,@htmlPreproc
" syntax region javaScriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=javaScriptSpecial,@htmlPreproc
" syntax region javaScriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=javaScriptSpecial,@htmlPreproc oneline
" syntax match javaScriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
" syntax match javaScriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
"}}}
"" JavaScript Prototype"{{{
syntax keyword javaScriptPrototype prototype
"}}}
" DOM, Browser and Ajax Support {{{
syntax keyword javaScriptBrowserObjects window navigator screen history location
@@ -149,15 +134,15 @@ if !exists("javascript_ignore_javaScriptdoc")
" While it can't be handled with context depended with Regex based highlight
" So, turn it off by default
if exists("javascript_enable_domhtmlcss")
" DOM2 things"{{{
" DOM2 things {{{
syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite
"}}}
" HTML things"{{{
" HTML things {{{
syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite
"}}}
" CSS Styles in JavaScript"{{{
" CSS Styles in JavaScript {{{
syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
@@ -170,16 +155,13 @@ if !exists("javascript_ignore_javaScriptdoc")
syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
"}}}
" Highlight ways"{{{
" Highlight ways {{{
syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs
syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles
"}}}
endif "DOM/HTML/CSS
"" end DOM/HTML/CSS specified things""}}}
" Code blocks
endif
" end DOM/HTML/CSS specified things }}}
" Code blocks"{{{
syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptString,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptWebAPI,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFuncKeyword,javaScriptConditional,javaScriptGlobal,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptMessage,javaScriptIdentifier,javaScriptExceptions,javaScriptReserved,javaScriptDeprecated,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation,javaScriptBrowserObjects,javaScriptDOMObjects,javaScriptAjaxObjects,javaScriptPropietaryObjects,javaScriptDOMMethods,javaScriptHtmlElemProperties,javaScriptDOMProperties,javaScriptEventListenerKeywords,javaScriptEventListenerMethods,javaScriptAjaxProperties,javaScriptAjaxMethods,javaScriptFuncArg
if main_syntax == "javascript"
@@ -187,22 +169,22 @@ if !exists("javascript_ignore_javaScriptdoc")
syntax sync ccomment javaScriptComment minlines=200
" syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
endif
"}}}
" Function and arguments highlighting {{{
syntax keyword javaScriptFuncKeyword function contained
"syntax region javaScriptFuncDef start="function" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend
syntax region javascriptFuncExp start=/\w\+\s\==\s\=function/ end="\([^)]*\)" contains=javascriptFuncEq,javascriptFuncKeyword,javascriptFuncArg keepend
syntax match javaScriptFuncArg "\(([^()]*)\)" contains=javaScriptParens,javaScriptFuncComma contained
syntax match javaScriptFuncComma /,/ contained
syntax match javascriptFuncEq /=/ contained
syntax region javaScriptFuncDef start="function" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend
" syntax region javaScriptFuncBlock contained matchgroup=javaScriptFuncBlock start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock fold
"}}}
" Braces, Parens, symbols, colons {{{
syn match javaScriptBraces "[{}\[\]]"
syn match javaScriptParens "[()]"
syn match javaScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
syn match javaScriptEndColons "[;,]"
syn match javaScriptLogicSymbols "\(&&\)\|\(||\)"
"}}}
" JavaScriptFold Function {{{
function! JavaScriptFold()
@@ -212,7 +194,6 @@ if !exists("javascript_ignore_javaScriptdoc")
endfunction
" }}}
" Highlight links {{{
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already