" Vim syntax file
" Language: JavaScript
" Maintainer: Yi Zhao (ZHAOYI) <zzlinux AT hotmail DOT com>
-" Last Change: May 17, 2007
-" Version: 0.7.5
-" Changes: 1, Get the vimdiff problem fixed finally.
-" Matthew Gallant reported the problem and test the fix. ;)
-" 2, Follow the suggestioin from Ingo Karkat.
-" The 'foldtext' and 'foldlevel' settings should only be
-" changed if the file being edited is pure JavaScript,
-" not if JavaScript syntax is embedded inside other syntaxes.
-" 3, Remove function FT_JavaScriptDoc().
-" Since VIM do the better than me.
+" Last Change: June 4, 2009
+" Version: 0.7.7
+" Changes: Add "undefined" as a type keyword
"
" TODO:
" - Add the HTML syntax inside the JSDoc
setlocal iskeyword+=$
syntax sync fromstart
-syntax sync maxlines=200
"" JavaScript comments
syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
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 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*:\)\@=/
"" Programm Keywords
syntax keyword javaScriptSource import export
-syntax keyword javaScriptType const this var void yield
+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
syntax match javaScriptParensErrC contained "}"
if main_syntax == "javascript"
- syntax sync ccomment javaScriptComment
+ syntax sync clear
+ syntax sync ccomment javaScriptComment minlines=200
+ syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
endif
"" Fold control