Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit 37232e39d73ad8bf0567f171463a8068dc0a2755 0 parents
@rgrove rgrove authored
1  .gitignore
@@ -0,0 +1 @@
+.*.swp
17 README.md
@@ -0,0 +1,17 @@
+Vim Syntax for YUI3
+===================
+
+This is a simple Vim syntax for YUI3 that's meant to augment Yi Zhao's javascript.vim syntax.
+
+Installation
+------------
+
+1. Copy `after/syntax/javascript.vim` to your `~/.vim/after/syntax/` directory (create the directory if it doesn't exist).
+2. If you aren't already using Yi Zhao's javascript.vim syntax, copy `syntax/javascript.vim` to your `~/.vim/syntax/` directory.
+
+Contributing
+------------
+
+The YUI3 syntax is generated automatically by the `raw2syntax.rb` script from a YUIDoc `raw.json` data file. To modify the syntax, edit the `syntax.erb` template; don't edit the generated syntax file itself.
+
+I know little about vim syntaxes, so this thing can probably be improved. Patches and feedback are very welcome.
19 after/syntax/javascript.vim
@@ -0,0 +1,19 @@
+" Vim syntax file
+" Language: YUI3
+" Maintainer: Ryan Grove <ryan@wonko.com>
+" Last Change: September 23, 2010
+
+" This syntax file is meant to augment Yi Zhao's javascript.vim syntax. Install
+" it in your ~/.vim/after/syntax/ directory so it will run after the original
+" javascript.vim.
+"
+" This is a bit hacky right now, but it works. Someone who knows more about vim
+" syntax files than I do should make this better.
+
+syntax keyword javaScriptGlobalObjects Y YUI Align AlterArgs AlterReturn Anim Array ArrayAssert ArrayList Assert AsyncQueue Attribute Base Cache CacheOffline Case ClassNameManager ClickableRail ComparisonFailure Console ConsoleFilters Cookie Coverage CreateLinkBase CustomEvent DD DDConstrained DDM DDNodeScroll DDProxy DDWindowScroll DOM DOMEventFacade DataSchema DataSource DataSourceArraySchema DataSourceCache DataSourceCacheExtension DataSourceJSONSchema DataSourceTextSchema DataSourceXMLSchema DataType Date DateAssert Delegate Do Drag Drop Easing EditorBase EditorBidi EditorLists EditorPara EditorTab Error Event EventFacade EventHandle EventTarget ExecCommand Flick Format Frame Function Get Halt History HistoryBase HistoryHTML5 HistoryHash Host IO ImgLoadGroup ImgLoadImgObj Intl JSON JSONPRequest Lang Loader Local Locale Manager Method Mock Module Node NodeFX NodeFocusManager NodeList NodeMenuNav Notifier Number Object ObjectAssert Overlay Plugin Pollable Prevent Profiler QueryString Queue Reporter Runner SWF Scroll ScrollView ScrollViewPaginator ScrollViewScrollbars Selection Selector Shim ShouldError ShouldFail Slider SliderBase SliderValueRange SortScroll Sortable State StyleSheet Subscriber Suite SyntheticEvent Tab TabView Test Text Transition UA UnexpectedError UnexpectedValue Uploader Value ValueChange Wait Widget WidgetAnim WidgetChild WidgetParent WidgetPosition WidgetPositionAlign WidgetPositionConstrain WidgetStack WidgetStdMod XML YQL YQLRequest YUI config io plugin
+syntax keyword javaScriptFunction FILTER_RGB JSON JUnitXML TAP XML XdebugJSON _getX _getY _hostScrollEnd _rls _setX _setY _test _tokenize _validateXY abort add addAll addAttr addAttrs addClass addCustomTrigger addField addGroup addHTML addHandle addInvalid addMethod addModule addParents addTarget addToGroup addTrigger addValue addclass after afterHostEvent afterHostMethod aggregate align all ancestor append appendChild apply applyConfig applyTo areEqual areNotEqual areNotSame areSame assert attach attrAdded augment backBoth backIn backOut backcolor before beforeHostMethod bind bindUI blockParent blur bounceBoth bounceIn bounceOut bubble build byId cached calculate callSWF cancel center centered cleanCursor clear clearAllIntervals clearCache clearConsole clearData clearFileList clearInterval clone cloneNode collapse command compareTo compileFilter constrain \contains containsItems containsMatch copyStyles create createDrop createHash createRange createlink css dateToString datesAreEqual decode define delegate delete deselectAll destroy destructor detach detachAll detachDelegate disable disableLogging doAfter doBefore docHeight docScrollX docScrollY docWidth doesNotContain doesNotContainItems doesNotContainMatch dump each easeBoth easeBothStrong easeIn easeInStrong easeNone easeOut easeOutStrong elasticBoth elasticIn elasticOut elementByAxis enable enableLogging encode end error even every exec execCommand exists expand expect extend fail fetch fillHeight filter filterBlocks find fire flash flush flushAll focus focusCursor fontname fontsize format formatSkin generateId get getAll getAttibute getAttribute getAttrs getAvailableLangs getAverage getBestMatch getBezier getBookmarkedState getByNode getCallCount getCallback getClassName getComputedStyle getConstrainedXY getContent getCoverage getCssText getCurrentState getCursor getDOMNode getDOMNodes getData getDefaultLocale getDelegate getDomPath getDrag getDrop getElementsByTagName getEvent getFullReport getFunctionReport getHash getId getInstance getLang getLangPackName getListeners getLocationValue getMax getMessage getMin getName getNode getOrdering getOriginal getPath getProvides getQueryStringParameter getRegion getReport getRequires getResults getSelected getSkinName getSortable getStdModNode getString getStrings getStyle getSub getSubs getTargets getText getUrl getValue getX getXY getY grep guid halt hasAttribute hasChildNodes hasClass hasKey hasKeys hasPlugin hasValue hash header hide hideCategory hideSource hilitecolor importMethod inDoc inGroup inRegion inViewportRegion indexOf init initialize initializer insert insertAtCursor insertBefore insertContent insertandfocus insertbr inserthtml insertimage insertorderedlist insertunorderedlist instrument intersect invoke io isArray isBoolean isDate isEmpty isEnabled isFalse isFunction isInstanceOf isNaN isNotEmpty isNotNaN isNotNull isNotUndefined isNull isNumber isObject isOverTarget isRoot isRunning isString isTrue isTypeOf isUndefined isValidSelector isValue isWaiting issueCallback item itemsAreEqual itemsAreEquivalent itemsAreSame join jsonp keys last lastIndexOf later load loadNext log lookupBestLang map merge message mix modifyAttr modulus monitor move multiNavigate namespace navigate next notify numericSort odd on onAvailable onCSS onContentReady onFailure onHostEvent onProgress onSuccess onTimeout once one owns ownsKey ownsKeys ownsNoKeys parse parseHash partition pause plug prepend prev preventDefault previous printBuffer processArgs promote publish purge purgeElement query queryAll rbind reduce refresh refreshConsole reg regDelegate region register registerConstructor registerFunction registerImage registerObject reject remove removeAll removeAttr removeAttribute removeChild removeClass removeCursor removeFile removeFromGroup removeHandle removeInvalid removeSub removeTarget removeclass render renderRail renderThumb replace replaceChild replaceClass replaceHash replaceValue report require reset resetCache resolve resume retrieve run script scrollIntoView scrollTo scrollToLatest scrubVal select selectAll selectChild selectNode send sendRequest set setAttibute setAttribute setAttrs setBounds setContent setCursor setData setHash setHeight setInterval setLang setName setPages setStdModContent setStyle setStyles setSub setSubs setText setUp setValue setWidth setX setXY setY show showCategory showSource siblings simulate size sizeShim snapToCurrent some stamp start stop stopDrag stopImmediatePropagation stopPropagation stringify sub subMatch submit subscribe substitute swap swapNode swapPosition swapXY sync syncActiveShims syncTargets syncUI syncXY tearDown test throttle timesAreEqual to toCssText toFrag toString toggleClass transition transport trim type unfilter unique unplug unreg unregisterFunction unregisterObject unset unsubscribe unsubscribeAll upload uploadAll uploadThese use validClick valueOf values verify viewportRegion wait winHeight winWidth wrap wrapContent zip
+syntax keyword javaScriptYUI3Constant containedin=javaScriptBlock INVALID_VALUE NAME NS POLL_INTERVAL POLL_RETRYS SRC_ADD SRC_HASH SRC_POPSTATE SRC_REPLACE TEST_MANAGER_BEGIN_EVENT TEST_MANAGER_COMPLETE_EVENT TEST_PAGE_BEGIN_EVENT TEST_PAGE_COMPLETE_EVENT UI_SRC currentState id initialState
+syntax keyword javaScriptYUI3Property containedin=javaScriptBlock 2in3 AFTER ALL ANIMATIONS ATTRS Any BASE_URL BC BEFORE BL BLOCKS BODY BODY_TEMPLATE BOUNCE_RANGE BOUNDING_TEMPLATE BR Boolean CATEGORIES_TEMPLATE CC CHROME_CLASSES CLASS_NAME CLASS_NAMES COMMANDS CONTENT_TEMPLATE CSS_PREFIX CURSOR CUR_WRAPID DEFAULT DEFAULT_CSS DEFAULT_GETTER DEFAULT_SETTER DEFAULT_TAG DEFAULT_UNIT DEF_PARENT_NODE DEF_UNIT DIV_WRAPPER DOC_TYPE DOMReady DOM_EVENTS EASING ENTRY_CLASSES ENTRY_TEMPLATE ENV EVENTS FILTER_TEMPLATE FOOTER FOOTER_TEMPLATE FORMAT FRAME_STEP Function Global HEADER HEADER_TEMPLATE HTML HTML_PARSER LC LOG_LEVEL_ERROR LOG_LEVEL_INFO LOG_LEVEL_WARN META NAME NC_KEYS NONSEL NS Number Object PAGE_HTML PARENT_NODE POSITIONED_CLASS_NAME PROMPT PROTO RAIL_TEMPLATE RC REG_CHAR REG_NON REMOVE REPLACE RE_DEFAULT_UNIT ROOT_TYPE SCROLLBAR_TEMPLATE SECTION_CLASS_NAMES SHIM_CLASS_NAME SHIM_TEMPLATE SHIM_TEMPLATE_TITLE SNAP_DURATION SNAP_EASING SOURCES_TEMPLATE STACKED_CLASS_NAME START_EVENT STRINGS STRIP_HTML String TABKEY TAG2CMD TC TEMPLATE TEMPLATES THUMB_TEMPLATE TL TMP TR UI_EVENTS UI_SRC USE VELOCITY_THRESHOLD _NODE_SELECTED _active _event _should actXY activeDrag activeDrop actual afters air allowRollup anchorNode anchorOffset anchorTextNode android args async base behaviors bidi bootstrap broadcast bubbles button caja cause charCode charset chrome classNameDelimiter classNamePrefix combine comboBase context core cssAttributes currentTarget data dateFormat dd defaultFn defaults delay delegate deltaXY details dirty doc emitFacade errorFn events evt expected fetchCSS filter filters fireOnce fired firedWith fn focusNode focusOffset focusTextNode force format frame gallery gecko hashPrefix host html5 id ie ignore ignoreRegistered injected insertBefore inserted intervalTime ios ipad iphone ipod isCollapsed jsAttributes keyCode lang lastError lastScrolledAmt lastXY loadOptional loaded loaderPath locale logExclude logFn logInclude maxURLLength mobile moduleInfo modules monitored mouseXY name nativeHashChange nodeXY objs onCSS once opera operators os otherDrops overTarget pageX pageY patterns pollInterval preventDups preventable prevented preventedFn purgethreshold queuable rail realXY region relatedTarget required rls rls_base rls_tmpl rollups root secure segment shim shorthand signature silent skin skipped sorted stack startXY stopped stoppedFn sub subscribers target targets text throwFail thumb timeout title transactions type unexpected url useBrowserConsole useHash useHistoryHTML5 useNativeParse useNativeStringify use_rls validDrops version webkit wheelDelta which win windowResizeDelay yui2
+
+hi link javaScriptYUI3Constant Constant
+hi link javaScriptYUI3Property Identifier
1  raw.json
1 addition, 0 deletions not shown
61 raw2syntax.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/env ruby
+
+# This script converts a YUIDoc raw.json metadata file into a vim language
+# syntax. It requires the erubis and json gems.
+
+require 'rubygems'
+require 'erubis'
+require 'json'
+
+# Words that need to be escaped in the syntax output.
+ESCAPE = %w{
+ contained containedin contains display fold nextgroup oneline skipempty
+ skipnl skipwhite transparent
+}
+
+EXCLUDE_CLASSES = []
+EXCLUDE_CONSTANTS = []
+EXCLUDE_FUNCTIONS = ['()', 'DEFAULT_GETTER', 'DEFAULT_SETTER']
+EXCLUDE_VARIABLES = []
+
+api = JSON.parse(File.read('raw.json'))
+
+classes = []
+constants = []
+functions = []
+variables = []
+version = api['version']
+
+api['classmap'].each do |classname, classdata|
+ # Classes
+ classname.split('.').each do |name|
+ classes << name unless name.include?('~') || EXCLUDE_CLASSES.include?(name)
+ end
+
+ # Constants/Variables/Properties
+ (classdata['properties'] || {}).each do |propname, propdata|
+ next if propdata['protected'] || propdata['private']
+ propname = $1 if propname =~ /\.([^\.]+)$/
+
+ if propdata['final']
+ constants << propname unless EXCLUDE_CONSTANTS.include?(propname)
+ else
+ variables << propname unless EXCLUDE_VARIABLES.include?(propname)
+ end
+ end
+
+ # Functions/Methods
+ (classdata['methods'] || {}).each do |methodname, methoddata|
+ next if methoddata['protected'] || methoddata['private'] || methodname =~ /\s/
+ methodname = $1 if methodname =~ /\.([^\.]+)$/
+ functions << methodname unless EXCLUDE_FUNCTIONS.include?(methodname)
+ end
+end
+
+[classes, constants, functions, variables].each do |keywords|
+ keywords.uniq!
+ keywords.sort!
+ keywords.map! {|w| ESCAPE.include?(w) ? "\\#{w}" : w }
+end
+
+puts Erubis::Eruby.new(File.read('syntax.erb')).result(binding)
19 syntax.erb
@@ -0,0 +1,19 @@
+" Vim syntax file
+" Language: YUI3
+" Maintainer: Ryan Grove <ryan@wonko.com>
+" Last Change: <%= Time.now.strftime('%B %d, %Y') %>
+
+" This syntax file is meant to augment Yi Zhao's javascript.vim syntax. Install
+" it in your ~/.vim/after/syntax/ directory so it will run after the original
+" javascript.vim.
+"
+" This is a bit hacky right now, but it works. Someone who knows more about vim
+" syntax files than I do should make this better.
+
+syntax keyword javaScriptGlobalObjects Y YUI <%= classes.join(' ') %>
+syntax keyword javaScriptFunction <%= functions.join(' ') %>
+syntax keyword javaScriptYUI3Constant containedin=javaScriptBlock <%= constants.join(' ') %>
+syntax keyword javaScriptYUI3Property containedin=javaScriptBlock <%= variables.join(' ') %>
+
+hi link javaScriptYUI3Constant Constant
+hi link javaScriptYUI3Property Identifier
246 syntax/javascript.vim
@@ -0,0 +1,246 @@
+" Vim syntax file
+" Language: JavaScript
+" Maintainer: Yi Zhao (ZHAOYI) <zzlinux AT hotmail DOT com>
+" Last Change: June 4, 2009
+" Version: 0.7.7
+" Changes: Add "undefined" as a type keyword
+"
+" TODO:
+" - Add the HTML syntax inside the JSDoc
+
+if !exists("main_syntax")
+ if version < 600
+ syntax clear
+ elseif exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'javascript'
+endif
+
+"" Drop fold if it set but VIM doesn't support it.
+let b:javascript_fold='true'
+if version < 600 " Don't support the old version
+ unlet! b:javascript_fold
+endif
+
+"" dollar sigh is permittd anywhere in an identifier
+setlocal iskeyword+=$
+
+syntax sync fromstart
+
+"" JavaScript comments
+syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
+syntax region javaScriptLineComment start=+\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell
+syntax region javaScriptLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell fold
+syntax region javaScriptCvsTag start="\$\cid:" end="\$" oneline contained
+syntax region javaScriptComment start="/\*" end="\*/" contains=javaScriptCommentTodo,javaScriptCvsTag,@Spell fold
+
+"" JSDoc support start
+if !exists("javascript_ignore_javaScriptdoc")
+ syntax case ignore
+
+ "" syntax coloring for javadoc comments (HTML)
+ "syntax include @javaHtml <sfile>:p:h/html.vim
+ "unlet b:current_syntax
+
+ syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,javaScriptCvsTag,@javaScriptHtml,@Spell fold
+ syntax match javaScriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
+ syntax match javaScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
+ syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
+ syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
+
+ syntax case match
+endif "" JSDoc end
+
+syntax case match
+
+"" Syntax in the JavaScript code
+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
+
+"" Programm Keywords
+syntax keyword javaScriptSource import export
+syntax keyword javaScriptType const this undefined var void yield
+syntax keyword javaScriptOperator delete new in instanceof let typeof
+syntax keyword javaScriptBoolean true false
+syntax keyword javaScriptNull null
+
+"" Statement Keywords
+syntax keyword javaScriptConditional if else
+syntax keyword javaScriptRepeat do while for
+syntax keyword javaScriptBranch break continue switch case default return
+syntax keyword javaScriptStatement try catch throw with finally
+
+syntax keyword javaScriptGlobalObjects Array Boolean Date Function Infinity JavaArray JavaClass JavaObject JavaPackage Math Number NaN Object Packages RegExp String Undefined java netscape sun
+
+syntax keyword javaScriptExceptions Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
+
+syntax keyword javaScriptFutureKeys 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
+
+"" DOM/HTML/CSS specified things
+
+ " DOM2 Objects
+ syntax keyword javaScriptGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
+ syntax keyword javaScriptExceptions DOMException
+
+ " DOM2 CONSTANT
+ syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
+ syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
+
+ " HTML events and internal variables
+ syntax case ignore
+ syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
+ syntax case match
+
+" Follow stuff should be highligh within a special context
+" 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
+ 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
+ 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
+ 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
+ syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex
+ syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
+ syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
+ syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
+ syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
+ syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
+ 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
+ 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
+syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptStringD,javaScriptStringS,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptType,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFunction,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptExceptions,javaScriptFutureKeys,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation
+syntax region javaScriptBracket matchgroup=javaScriptBracket transparent start="\[" end="\]" contains=@javaScriptAll,javaScriptParensErrB,javaScriptParensErrC,javaScriptBracket,javaScriptParen,javaScriptBlock,@htmlPreproc
+syntax region javaScriptParen matchgroup=javaScriptParen transparent start="(" end=")" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrC,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
+syntax region javaScriptBlock matchgroup=javaScriptBlock transparent start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
+
+"" catch errors caused by wrong parenthesis
+syntax match javaScriptParensError ")\|}\|\]"
+syntax match javaScriptParensErrA contained "\]"
+syntax match javaScriptParensErrB contained ")"
+syntax match javaScriptParensErrC contained "}"
+
+if main_syntax == "javascript"
+ syntax sync clear
+ syntax sync ccomment javaScriptComment minlines=200
+ syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
+endif
+
+"" Fold control
+if exists("b:javascript_fold")
+ syntax match javaScriptFunction /\<function\>/ nextgroup=javaScriptFuncName skipwhite
+ syntax match javaScriptOpAssign /=\@<!=/ nextgroup=javaScriptFuncBlock skipwhite skipempty
+ syntax region javaScriptFuncName contained matchgroup=javaScriptFuncName start=/\%(\$\|\w\)*\s*(/ end=/)/ contains=javaScriptLineComment,javaScriptComment nextgroup=javaScriptFuncBlock skipwhite skipempty
+ syntax region javaScriptFuncBlock contained matchgroup=javaScriptFuncBlock start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock fold
+
+ if &l:filetype=='javascript' && !&diff
+ " Fold setting
+ " Redefine the foldtext (to show a JS function outline) and foldlevel
+ " only if the entire buffer is JavaScript, but not if JavaScript syntax
+ " is embedded in another syntax (e.g. HTML).
+ setlocal foldmethod=syntax
+ setlocal foldlevel=4
+ endif
+else
+ syntax keyword javaScriptFunction function
+ setlocal foldmethod<
+ setlocal foldlevel<
+endif
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_javascript_syn_inits")
+ if version < 508
+ let did_javascript_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+ HiLink javaScriptComment Comment
+ HiLink javaScriptLineComment Comment
+ HiLink javaScriptDocComment Comment
+ HiLink javaScriptCommentTodo Todo
+ HiLink javaScriptCvsTag Function
+ HiLink javaScriptDocTags Special
+ HiLink javaScriptDocSeeTag Function
+ HiLink javaScriptDocParam Function
+ HiLink javaScriptStringS String
+ HiLink javaScriptStringD String
+ HiLink javaScriptRegexpString String
+ HiLink javaScriptCharacter Character
+ HiLink javaScriptPrototype Type
+ HiLink javaScriptConditional Conditional
+ HiLink javaScriptBranch Conditional
+ HiLink javaScriptRepeat Repeat
+ HiLink javaScriptStatement Statement
+ HiLink javaScriptFunction Function
+ HiLink javaScriptError Error
+ HiLink javaScriptParensError Error
+ HiLink javaScriptParensErrA Error
+ HiLink javaScriptParensErrB Error
+ HiLink javaScriptParensErrC Error
+ HiLink javaScriptOperator Operator
+ HiLink javaScriptType Type
+ HiLink javaScriptNull Type
+ HiLink javaScriptNumber Number
+ HiLink javaScriptFloat Number
+ HiLink javaScriptBoolean Boolean
+ HiLink javaScriptLabel Label
+ HiLink javaScriptSpecial Special
+ HiLink javaScriptSource Special
+ HiLink javaScriptGlobalObjects Special
+ HiLink javaScriptExceptions Special
+
+ HiLink javaScriptDomErrNo Constant
+ HiLink javaScriptDomNodeConsts Constant
+ HiLink javaScriptDomElemAttrs Label
+ HiLink javaScriptDomElemFuncs PreProc
+
+ HiLink javaScriptHtmlEvents Special
+ HiLink javaScriptHtmlElemAttrs Label
+ HiLink javaScriptHtmlElemFuncs PreProc
+
+ HiLink javaScriptCssStyles Label
+
+ delcommand HiLink
+endif
+
+" Define the htmlJavaScript for HTML syntax html.vim
+"syntax clear htmlJavaScript
+"syntax clear javaScriptExpression
+syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError
+syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc
+
+let b:current_syntax = "javascript"
+if main_syntax == 'javascript'
+ unlet main_syntax
+endif
+
+" vim: ts=4
Please sign in to comment.
Something went wrong with that request. Please try again.