Skip to content

Commit

Permalink
Better support for es6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Jul 19, 2015
1 parent 852d25b commit c925c92
Show file tree
Hide file tree
Showing 29 changed files with 547 additions and 310 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
- [jade](https://github.com/digitaltoad/vim-jade) (syntax, indent, ftplugin, ftdetect)
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftdetect)
- [javascript](https://github.com/sheerun/yajs.vim) (syntax, indent)
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
Expand Down
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ PACKS="
html5:othree/html5.vim
jade:digitaltoad/vim-jade
jasmine:glanotte/vim-jasmine
javascript:pangloss/vim-javascript
javascript:sheerun/yajs.vim
julia:dcjones/julia-minimalist-vim
json:sheerun/vim-json
jst:briancollins/vim-jst
Expand Down
12 changes: 0 additions & 12 deletions ftdetect/polyglot.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1

autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

au BufNewFile,BufRead *.js setf javascript
au BufNewFile,BufRead *.jsm setf javascript
au BufNewFile,BufRead Jakefile setf javascript
fun! s:SelectJavascript()
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
set ft=javascript
endif
endfun
au BufNewFile,BufRead * call s:SelectJavascript()
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1

autocmd BufNewFile,BufRead *.json set filetype=json
Expand Down
670 changes: 374 additions & 296 deletions syntax/javascript.vim

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions syntax/semhl.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1


" syntax match javascriptIdentifierName /\<[^=<>!?+\-*\/%|&,;:. ~@#`"'\[\]\(\)\{\}\^0-9][^=<>!?+\-*\/%|&,;:. ~@#`"'\[\]\(\)\{\}\^]*/ nextgroup=javascriptDotNotation,javascriptFuncCallArg,javascriptComputedProperty,javascriptWSymbols contains=@_smantic

syntax cluster _semantic contains=_semantic0,_semantic1,_semantic2,_semantic3,_semantic4,_semantic5,_semantic6,_semantic7,_semantic8,_semantic9,_semantic10,_semantic11,_semantic12,_semantic13,_semantic14,_semantic15,_semantic16,_semantic17,_semantic18,_semantic19,_semantic20,_semantic21,_semantic22,_semantic23,_semantic24,_semantic25

endif
9 changes: 9 additions & 0 deletions syntax/yajs/dom-document.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

{ [Error: ENOENT, no such file or directory 'dom-document.yml']
errno: -2,
code: 'ENOENT',
path: 'dom-document.yml',
syscall: 'open' }

endif
9 changes: 9 additions & 0 deletions syntax/yajs/dom-elem.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

{ [Error: ENOENT, no such file or directory 'dom-elem.yml']
errno: -2,
code: 'ENOENT',
path: 'dom-elem.yml',
syscall: 'open' }

endif
9 changes: 9 additions & 0 deletions syntax/yajs/dom-event.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

{ [Error: ENOENT, no such file or directory 'dom-event.yml']
errno: -2,
code: 'ENOENT',
path: 'dom-event.yml',
syscall: 'open' }

endif
9 changes: 9 additions & 0 deletions syntax/yajs/dom-node.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

{ [Error: ENOENT, no such file or directory 'dom-node.yml']
errno: -2,
code: 'ENOENT',
path: 'dom-node.yml',
syscall: 'open' }

endif
9 changes: 9 additions & 0 deletions syntax/yajs/dom-storage.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

{ [Error: ENOENT, no such file or directory 'dom-storage.yml']
errno: -2,
code: 'ENOENT',
path: 'dom-storage.yml',
syscall: 'open' }

endif
5 changes: 5 additions & 0 deletions syntax/yajs/ecma-402.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Intl

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-array.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Array nextgroup=javascriptGlobalArrayDot,javascriptFuncCallArg
syntax match javascriptGlobalArrayDot /\./ contained nextgroup=javascriptArrayStaticMethod

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-date.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Date nextgroup=javascriptGlobalDateDot,javascriptFuncCallArg
syntax match javascriptGlobalDateDot /\./ contained nextgroup=javascriptDateStaticMethod

endif
5 changes: 5 additions & 0 deletions syntax/yajs/es6-function.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Function

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-json.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal JSON nextgroup=javascriptGlobalJSONDot,javascriptFuncCallArg
syntax match javascriptGlobalJSONDot /\./ contained nextgroup=javascriptJSONStaticMethod

endif
5 changes: 5 additions & 0 deletions syntax/yajs/es6-map.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Map WeakMap

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-math.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Math nextgroup=javascriptGlobalMathDot,javascriptFuncCallArg
syntax match javascriptGlobalMathDot /\./ contained nextgroup=javascriptMathStaticProp,javascriptMathStaticMethod

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-number.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Number nextgroup=javascriptGlobalNumberDot,javascriptFuncCallArg
syntax match javascriptGlobalNumberDot /\./ contained nextgroup=javascriptNumberStaticProp,javascriptNumberStaticMethod

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-object.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Object nextgroup=javascriptGlobalObjectDot,javascriptFuncCallArg
syntax match javascriptGlobalObjectDot /\./ contained nextgroup=javascriptObjectStaticMethod

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-promise.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Promise nextgroup=javascriptGlobalPromiseDot,javascriptFuncCallArg
syntax match javascriptGlobalPromiseDot /\./ contained nextgroup=javascriptPromiseStaticMethod

endif
5 changes: 5 additions & 0 deletions syntax/yajs/es6-proxy.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Proxy

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-regexp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal RegExp nextgroup=javascriptGlobalRegExpDot,javascriptFuncCallArg
syntax match javascriptGlobalRegExpDot /\./ contained nextgroup=javascriptRegExpStaticProp

endif
5 changes: 5 additions & 0 deletions syntax/yajs/es6-set.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Set WeakSet

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-string.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal String nextgroup=javascriptGlobalStringDot,javascriptFuncCallArg
syntax match javascriptGlobalStringDot /\./ contained nextgroup=javascriptStringStaticMethod

endif
6 changes: 6 additions & 0 deletions syntax/yajs/es6-symbol.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Symbol nextgroup=javascriptGlobalSymbolDot,javascriptFuncCallArg
syntax match javascriptGlobalSymbolDot /\./ contained nextgroup=javascriptSymbolStaticProp,javascriptSymbolStaticMethod

endif
4 changes: 4 additions & 0 deletions syntax/yajs/event.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1


endif
17 changes: 17 additions & 0 deletions syntax/yajs/javascript.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptGlobal Function Boolean Error EvalError InternalError RangeError
syntax keyword javascriptGlobal ReferenceError StopIteration SyntaxError TypeError
syntax keyword javascriptGlobal URIError Date Float32Array Float64Array Int16Array
syntax keyword javascriptGlobal Int32Array Int8Array Uint16Array Uint32Array Uint8Array
syntax keyword javascriptGlobal Uint8ClampedArray ParallelArray ArrayBuffer DataView
syntax keyword javascriptGlobal Iterator Generator Reflect Proxy arguments
if exists("did_javascript_hilink") | HiLink javascriptGlobal Structure
endif
syntax keyword javascriptGlobalMethod eval uneval isFinite isNaN parseFloat parseInt nextgroup=javascriptFuncCallArg
syntax keyword javascriptGlobalMethod decodeURI decodeURIComponent encodeURI encodeURIComponent nextgroup=javascriptFuncCallArg
syntax cluster props add=javascriptGlobalMethod
if exists("did_javascript_hilink") | HiLink javascriptGlobalMethod Structure
endif

endif
8 changes: 8 additions & 0 deletions syntax/yajs/node.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1

syntax keyword javascriptNodeGlobal global process console Buffer module exports setTimeout
syntax keyword javascriptNodeGlobal clearTimeout setInterval clearInterval
if exists("did_javascript_hilink") | HiLink javascriptNodeGlobal Structure
endif

endif
4 changes: 4 additions & 0 deletions syntax/yajs/web.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1


endif

0 comments on commit c925c92

Please sign in to comment.