mirror of
https://github.com/jelera/vim-javascript-syntax.git
synced 2026-03-27 11:03:37 +08:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b8e2ee761 | ||
|
|
75338eee16 | ||
|
|
e65e4f01ba | ||
|
|
2af4a1bcf7 | ||
|
|
77f90362a0 | ||
|
|
63ed85b226 | ||
|
|
9c534024e1 | ||
|
|
1490ec63eb | ||
|
|
d0b26c1646 | ||
|
|
139ec9080f | ||
|
|
f054138292 | ||
|
|
9453348768 | ||
|
|
9a8f9ee849 | ||
|
|
43c653074d | ||
|
|
3a1bc19fb1 | ||
|
|
490a0fbb7c | ||
|
|
9e7ccf6dbe | ||
|
|
6222b85824 | ||
|
|
885939e965 | ||
|
|
9e019fccd7 | ||
|
|
e1ac433681 | ||
|
|
783f31a8ea | ||
|
|
747f267214 | ||
|
|
7064a6e555 | ||
|
|
502218a866 | ||
|
|
e7b2c327d4 | ||
|
|
b93c210c0e | ||
|
|
180e8937f0 | ||
|
|
18579fda9e | ||
|
|
c907b157ab | ||
|
|
e30ebd4a0e | ||
|
|
539dd14378 | ||
|
|
ed6a363cd7 | ||
|
|
7f04baf7be | ||
|
|
7614d41df9 | ||
|
|
8066c375aa | ||
|
|
92117af3bb | ||
|
|
82cb62c898 | ||
|
|
9ee13d82e1 | ||
|
|
386c24a265 | ||
|
|
46e76c0ba2 | ||
|
|
c4b467d1d8 | ||
|
|
99cef7b382 | ||
|
|
1c0ea2481d | ||
|
|
777312caaf | ||
|
|
fa7389a56b | ||
|
|
239388b99b | ||
|
|
4899b2c272 | ||
|
|
7ef78f4a2c | ||
|
|
1c08820db8 | ||
|
|
6de2864feb | ||
|
|
6777b611d2 | ||
|
|
5be88cba5d | ||
|
|
d3855f867a | ||
|
|
7a607a87e2 | ||
|
|
d6b3d6b9f3 | ||
|
|
dbbb25a89c | ||
|
|
8c6cba0bd2 | ||
|
|
0aeefd8035 | ||
|
|
c93090a7ab |
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at . All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Jose Elera
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,54 +0,0 @@
|
||||
#Enhanced Javascript Syntax for Vim
|
||||
|
||||
###Credits
|
||||
- Zhao Yi, Claudio Fleiner, Scott Shattuck (This file is based on their hard work)
|
||||
- gumnos (From the #vim IRC Channel in Freenode) (Who helped me figured out the crazy Vim Regexes)
|
||||
|
||||
###Description
|
||||
This file is a fork of [this file](http://www.vim.org/scripts/script.php?script_id=1491) and [the stock one](http://fleiner.com/vim/download.html)
|
||||
|
||||
This version of this file features the following text highlights:
|
||||
|
||||
- Parenthesis, curly and regular brackets.
|
||||
- The semicolon or comma at the end of line.
|
||||
- Browser, DOM and "Ajax" keywords like objects, methods, properties and others.
|
||||
- Operation, comparison and logical symbols (`=`,`==`,`===`,`!=`,etc.).
|
||||
|
||||
To enable code folding add the following to your `.vimrc`.
|
||||
|
||||
au FileType javascript call JavaScriptFold()
|
||||
|
||||
###Note
|
||||
This is a syntax plugin, not an indentation one. For indentation, this is the [recommended one](https://github.com/vim-scripts/JavaScript-Indent) by Preston Koprivica.
|
||||
|
||||
###Installation
|
||||
- Using [NeoBundle](https://github.com/Shougo/neobundle.vim) **(Which I recommend)**
|
||||
|
||||
NeoBundleLazy 'jelera/vim-javascript-syntax', {'autoload':{'filetypes':['javascript']}}
|
||||
|
||||
- Using [Vundle](https://github.com/gmarik/vundle)
|
||||
|
||||
Bundle 'jelera/vim-javascript-syntax'
|
||||
|
||||
- Using [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
$ cd ~/.vim/bundle
|
||||
$ git clone https://github.com/jelera/vim-javascript-syntax.git
|
||||
|
||||
|
||||
###TODO
|
||||
You can help me improve it too.
|
||||
|
||||
- ~~The separate highlight of the arguments~~ Thanks to [Billychan](https://github.com/jelera/vim-javascript-syntax/commit/b03f40ff6ddf605ac146634a651632d6c1e8a50b) for this
|
||||
- ~~I know this is a syntax file, but having an autocompletion file.~~ So far a better autocompletion can be achieved by [Tern for Vim](https://github.com/marijnh/tern_for_vim)
|
||||
- ~~Add keywords for the popular third-party libraries like jQuery, YUI, Prototype, etc.~~ This can be done with [this repo](https://github.com/othree/javascript-libraries-syntax.vim)
|
||||
|
||||
###Screenshots
|
||||
This is the stock Javascript syntax file
|
||||

|
||||
|
||||
This is with the Enhanced Syntax file
|
||||

|
||||
|
||||
###License
|
||||
The same as Vim
|
||||
77
README.md
Normal file
77
README.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Enhanced JavaScript Syntax for Vim
|
||||
|
||||
## Credits
|
||||
- Zhao Yi, Claudio Fleiner, Scott Shattuck (This file is based on their hard work)
|
||||
- gumnos (From the #vim IRC Channel in Freenode) (Who helped me figured out the
|
||||
crazy Vim Regexes)
|
||||
|
||||
## Description
|
||||
This file is a fork of [this file](http://www.vim.org/scripts/script.php?script_id=1491)
|
||||
and [the stock one](http://fleiner.com/vim/download.html)
|
||||
|
||||
This version of this file features the following text highlights:
|
||||
|
||||
- Parenthesis, curly and regular brackets.
|
||||
- The semicolon or comma at the end of line.
|
||||
- Browser, DOM and "Ajax" keywords like objects, methods, properties and others.
|
||||
- Operation, comparison and logical symbols (`=`,`==`,`===`,`!=`,etc.).
|
||||
- Separate highlight of the arguments. Thanks to [Billychan](https://github.com/jelera/vim-javascript-syntax/commit/b03f40ff6ddf605ac146634a651632d6c1e8a50b).
|
||||
|
||||
### Rationale
|
||||
While there are already a few syntax files in the wild (some even forks from this project), the goal is to have a syntax file that has current keywords for modern ES/JS development and to be fairly lean and quick on loading.
|
||||
|
||||
## Screenshots
|
||||
This is the stock Javascript syntax file
|
||||
#### Solarized Light
|
||||

|
||||
|
||||
This is with the Enhanced Syntax file
|
||||

|
||||
|
||||
More screenshots [here](http://imgur.com/a/7bnu3).
|
||||
|
||||
#### Hybrid
|
||||

|
||||
|
||||
This is with the Enhanced Syntax file
|
||||

|
||||
|
||||
## Installation
|
||||
- Using [Vim-Plug](https://github.com/junegunn/vim-plug) **(Which I recommend)**,
|
||||
add this line to your `.vimrc`
|
||||
|
||||
```vim
|
||||
Plug 'jelera/vim-javascript-syntax'
|
||||
```
|
||||
|
||||
- Using [Vundle](https://github.com/gmarik/vundle),
|
||||
add this line to your `.vimrc`
|
||||
|
||||
```vim
|
||||
Plugin 'jelera/vim-javascript-syntax'
|
||||
```
|
||||
|
||||
- Using [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||
run this command in your shell
|
||||
|
||||
```bash
|
||||
git clone https://github.com/jelera/vim-javascript-syntax.git ~/.vim/bundle/vim-javascript-syntax
|
||||
```
|
||||
|
||||
## Suggested Companion Plugins
|
||||
- **Indentation**
|
||||
The recommended way is to use [Prettier](https://prettier.io/docs/en/vim.html) and [ALE](https://github.com/dense-analysis/ale).
|
||||
|
||||
~~It can be achieved with [Javascript-Indent](https://github.com/vim-scripts/JavaScript-Indent) by Preston Koprivica. On my testing, it has proved to be the most capable and also indents HTML and JS inside HTML.
|
||||
The project is unmaintained for now, but you could fork it and improve upon it.~~
|
||||
- **Autocompletion**
|
||||
- [Coc.vim](https://github.com/neoclide/coc.nvim), as it supports **Language Server Protocol** as VSCode.
|
||||
- [Tern for Vim](https://github.com/marijnh/tern_for_vim)
|
||||
- Popular **third-party libraries support** like jQuery, YUI, Prototype, by [javascript-libraries-syntax](https://github.com/othree/javascript-libraries-syntax.vim)
|
||||
|
||||
## Contributions
|
||||
While all contributions are always welcome, make sure your commit message follow this
|
||||
[**convention**](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
||||
|
||||
## License
|
||||
The same as Vim
|
||||
@@ -1,5 +1,5 @@
|
||||
function! s:DetectJS()
|
||||
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
|
||||
if getline(1) =~# '^#!.*/bin/\(env\s\+\)\?node\>'
|
||||
setfiletype javascript
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
" Vim syntax file
|
||||
" Language: JavaScript
|
||||
" Maintainer: Jose Elera Campana <https://github.com/jelera>
|
||||
" Last Change: September, 17 2013
|
||||
" Version: 0.8.0
|
||||
" Changes: Go to https://github.com/jelera/vim-javascript-syntax for
|
||||
" recent changes.
|
||||
" Credits: Zhao Yi, Claudio Fleiner, Scott Shattuck (This file is based
|
||||
" on their hard work), gumnos (From the #vim IRC Channel in
|
||||
" Freenode)
|
||||
" Language: JavaScript
|
||||
" Maintainer: Jose Elera <https://github.com/jelera>
|
||||
" https://jelera.github.io
|
||||
" Last Modified: Thu 11 Jul 2019 11:53:28 AM CDT
|
||||
" Version: 0.8.2
|
||||
" Credits: Zhao Yi, Claudio Fleiner, Scott Shattuck (This file is based
|
||||
" on their hard work), gumnos (From the #vim IRC Channel in
|
||||
" Freenode), all the contributors at this project's github page
|
||||
" (https://github.com/jelera/vim-javascript-syntax/graphs/contributors)
|
||||
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
@@ -23,44 +23,41 @@ if version < 600 && exists("javaScript_fold")
|
||||
unlet javaScript_fold
|
||||
endif
|
||||
|
||||
"" dollar sign is permitted anywhere in an identifier
|
||||
setlocal iskeyword+=$
|
||||
|
||||
"" Remove dollar sign from identifier when embedded in a PHP file
|
||||
if &filetype == 'php'
|
||||
setlocal iskeyword-=$
|
||||
if &filetype == 'javascript'
|
||||
setlocal iskeyword+=$
|
||||
endif
|
||||
|
||||
syntax sync fromstart
|
||||
|
||||
"" syntax coloring for Node.js shebang line
|
||||
syn match shebang "^#!.*"
|
||||
syntax match shebang "^#!.*"
|
||||
hi link shebang Comment
|
||||
|
||||
" Statement Keywords {{{
|
||||
syntax keyword javaScriptSource import export
|
||||
syntax keyword javaScriptIdentifier arguments this let var void yield
|
||||
syntax keyword javaScriptSource import export from
|
||||
syntax keyword javaScriptIdentifier arguments this let var void yield async await const
|
||||
syntax keyword javaScriptOperator delete new instanceof typeof
|
||||
syntax keyword javaScriptBoolean true false
|
||||
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
|
||||
syntax keyword javaScriptDeprecated escape unescape applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding
|
||||
syntax keyword javaScriptConditional if else switch
|
||||
syntax keyword javaScriptRepeat do while for in
|
||||
syntax keyword javaScriptRepeat do while for in of
|
||||
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
|
||||
syntax keyword javaScriptReserved abstract all enum int short boolean export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public
|
||||
"}}}
|
||||
" 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
|
||||
syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD OPTIMIZE HACK REVIEW contained
|
||||
syntax match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
|
||||
syntax match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||
syntax region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
|
||||
"}}}
|
||||
" JSDoc support {{{
|
||||
if !exists("javascript_ignore_javaScriptdoc")
|
||||
@@ -69,9 +66,8 @@ if !exists("javascript_ignore_javaScriptdoc")
|
||||
" syntax coloring for JSDoc comments (HTML)
|
||||
"unlet b:current_syntax
|
||||
|
||||
syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,@javaScriptHtml,@Spell fold
|
||||
syntax match javaScriptDocTags contained "@\(param\|argument\|returns\=\|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\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
|
||||
syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,@javaScriptHtml,jsInJsdocExample,@Spell fold
|
||||
syntax match javaScriptDocTags contained "@\(abstract\|access\|alias\|arg\|argument\|augments\|author\|borrows\|callback\|class\|classdesc\|const\|constant\|constructor\|constructs\|copyright\|default\|defaultvalue\|deprecated\|desc\|description\|emits\|enum\|event\|example\|exception\|exports\|extends\|external\|file\|fileoverview\|fires\|func\|function\|global\|host\|ignore\|implements\|inheritdoc\|inner\|instance\|interface\|kind\|lends\|license\|link\|linkcode\|linkplain\|listens\|member\|memberof\|method\|mixes\|mixin\|module\|name\|namespace\|override\|overview\|param\|private\|prop\|property\|cfg\|protected\|public\|readonly\|requires\|return\|returns\|see\|since\|static\|summary\|this\|throws\|todo\|tutorial\|tutorial\|type\|typedef\|var\|variation\|version\|virtual\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
|
||||
syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
|
||||
syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
|
||||
|
||||
@@ -80,26 +76,37 @@ endif
|
||||
syntax case match
|
||||
"}}}
|
||||
" 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
|
||||
syntax match javaScriptSpecial "\\\d\d\d\|\\."
|
||||
syntax region javaScriptString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
|
||||
syntax region javaScriptString start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
|
||||
|
||||
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 javaScriptSpecialCharacter "'\\.'"
|
||||
syntax match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||
syntax 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 javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
||||
"}}}
|
||||
" DOM, Browser and Ajax Support {{{
|
||||
syntax keyword javaScriptBrowserObjects window navigator screen history location
|
||||
syntax keyword javaScriptBrowserObjects window navigator screen history location console
|
||||
|
||||
syntax keyword javaScriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea
|
||||
syntax keyword javaScriptDOMMethods createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode
|
||||
syntax keyword javaScriptDOMProperties nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName
|
||||
|
||||
|
||||
syntax keyword javaScriptLocalStorageObjects localStorage
|
||||
syntax keyword javaScriptLocalStorageMethods setItem getItem removeItem
|
||||
|
||||
syntax keyword javaScriptAjaxObjects XMLHttpRequest
|
||||
syntax keyword javaScriptAjaxProperties readyState responseText responseXML statusText
|
||||
syntax keyword javaScriptAjaxMethods onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader
|
||||
|
||||
syntax keyword javaScriptFetchAPIObjects Response Promise
|
||||
syntax keyword javaScriptFetchAPIMethods fetch then response clone redirect arrayBuffer blob formData allSettled race reject resolve
|
||||
syntax keyword javaScriptFetchAPIProperties headers ok redirected url useFinalURL bodyUsed
|
||||
|
||||
syntax keyword javaScriptJSONObject JSON
|
||||
syntax keyword javaScriptJSONMethods json stringify parse
|
||||
|
||||
syntax keyword javaScriptPropietaryObjects ActiveXObject
|
||||
syntax keyword javaScriptPropietaryMethods attachEvent detachEvent cancelBubble returnValue
|
||||
|
||||
@@ -116,7 +123,7 @@ syntax keyword javaScriptEventListenerMethods scrollIntoView addEventListen
|
||||
syntax keyword javaScriptWebAPI Element ElementTraversal Entity EntityReference Entry EntrySync ErrorEvent Event EventListener EventSource EventTarget Extensions File FileEntry FileEntrySync FileError FileException FileList FileReader FileSystem FileSystemSync Float32Array Float64Array FMRadio FocusEvent FormData GainNode Geolocation History
|
||||
syntax keyword javaScriptWebAPI HTMLAnchorElement HTMLAreaElement HTMLAudioElement HTMLBaseElement HTMLBaseFontElement HTMLBodyElement HTMLBRElement HTMLButtonElement HTMLCanvasElement HTMLCollection HTMLDataElement HTMLDataListElement HTMLDivElement HTMLDListElement HTMLDocument HTMLElement HTMLEmbedElement HTMLFieldSetElement HTMLFormControlsCollection HTMLFormElement HTMLHeadElement HTMLHeadingElement HTMLHRElement HTMLHtmlElement HTMLIFrameElement HTMLImageElement HTMLInputElement HTMLIsIndexElement HTMLKeygenElement HTMLLabelElement HTMLLegendElement HTMLLIElement HTMLLinkElement HTMLMapElement HTMLMediaElement HTMLMetaElement HTMLMeterElement HTMLModElement HTMLObjectElement HTMLOListElement HTMLOptGroupElement HTMLOptionElement HTMLOptionsCollection HTMLOutputElement HTMLParagraphElement HTMLParamElement HTMLPreElement HTMLProgressElement HTMLQuoteElement HTMLScriptElement HTMLSelectElement HTMLSourceElement HTMLSpanElement HTMLStyleElement HTMLTableCaptionElement HTMLTableCellElement HTMLTableColElement HTMLTableElement HTMLTableRowElement HTMLTableSectionElement HTMLTextAreaElement HTMLTimeElement HTMLTitleElement HTMLTrackElement HTMLUListElement HTMLUnknownElement HTMLVideoElement
|
||||
syntax keyword javaScriptWebAPI IDBCursor IDBCursorWithValue IDBDatabase IDBDatabaseException IDBEnvironment IDBFactory IDBIndex IDBKeyRange IDBObjectStore IDBOpenDBRequest IDBRequest IDBTransaction IDBVersionChangeEvent ImageData Int16Array Int32Array Int8Array KeyboardEvent LinkStyle LocalFileSystem LocalFileSystemSync Location MediaQueryList MediaQueryListListener MediaSource MediaStream MediaStreamTrack MessageEvent MouseEvent MouseScrollEvent MouseWheelEvent MozActivity MozActivityOptions MozActivityRequestHandler MozAlarmsManager MozContact MozContactChangeEvent MozIccManager MozMmsEvent MozMmsMessage MozMobileCellInfo MozMobileCFInfo MozMobileConnection MozMobileConnectionInfo MozMobileICCInfo MozMobileMessageManager MozMobileMessageThread MozMobileNetworkInfo MozNetworkStats MozNetworkStatsData MozNetworkStatsManager MozSettingsEvent MozSmsEvent MozSmsFilter MozSmsManager MozSmsMessage MozSmsSegmentInfo MozTimeManager MozWifiConnectionInfoEvent MutationObserver
|
||||
syntax keyword javaScriptWebAPI NamedNodeMap NameList Navigator NavigatorGeolocation NavigatorID NavigatorLanguage NavigatorOnLine NavigatorPlugins NetworkInformation Node NodeFilter NodeIterator NodeList Notation Notification NotifyAudioAvailableEvent OfflineAudioCompletionEvent OfflineAudioContext PannerNode ParentNode Performance PerformanceNavigation PerformanceTiming Plugin PluginArray Position PositionError PositionOptions PowerManager ProcessingInstruction ProgressEvent Promise PromiseResolver PushManager
|
||||
syntax keyword javaScriptWebAPI NamedNodeMap NameList Navigator NavigatorGeolocation NavigatorID NavigatorLanguage NavigatorOnLine NavigatorPlugins NetworkInformation Node NodeFilter NodeIterator NodeList Notation Notification NotifyAudioAvailableEvent OfflineAudioCompletionEvent OfflineAudioContext PannerNode ParentNode Performance PerformanceNavigation PerformanceTiming Plugin PluginArray Position PositionError PositionOptions PowerManager ProcessingInstruction ProgressEvent PromiseResolver PushManager
|
||||
syntax keyword javaScriptWebAPI Range ScriptProcessorNode Selection SettingsLock SettingsManager SharedWorker StyleSheet StyleSheetList SVGAElement SVGAngle SVGAnimateColorElement SVGAnimatedAngle SVGAnimatedBoolean SVGAnimatedEnumeration SVGAnimatedInteger SVGAnimatedLengthList SVGAnimatedNumber SVGAnimatedNumberList SVGAnimatedPoints SVGAnimatedPreserveAspectRatio SVGAnimatedRect SVGAnimatedString SVGAnimatedTransformList SVGAnimateElement SVGAnimateMotionElement SVGAnimateTransformElement SVGAnimationElement SVGCircleElement SVGClipPathElement SVGCursorElement SVGDefsElement SVGDescElement SVGElement SVGEllipseElement SVGFilterElement SVGFontElement SVGFontFaceElement SVGFontFaceFormatElement SVGFontFaceNameElement SVGFontFaceSrcElement SVGFontFaceUriElement
|
||||
syntax keyword javaScriptWebAPI SVGForeignObjectElement SVGGElement SVGGlyphElement SVGGradientElement SVGHKernElement SVGImageElement SVGLength SVGLengthList SVGLinearGradientElement SVGLineElement SVGMaskElement SVGMatrix SVGMissingGlyphElement SVGMPathElement SVGNumber SVGNumberList SVGPathElement SVGPatternElement SVGPolygonElement SVGPolylineElement SVGPreserveAspectRatio SVGRadialGradientElement SVGRect SVGRectElement SVGScriptElement SVGSetElement SVGStopElement SVGStringList SVGStylable SVGStyleElement SVGSVGElement SVGSwitchElement SVGSymbolElement SVGTests SVGTextElement SVGTextPositioningElement SVGTitleElement SVGTransform SVGTransformable SVGTransformList SVGTRefElement SVGTSpanElement SVGUseElement SVGViewElement SVGVKernElement TCPSocket Telephony TelephonyCall Text TextDecoder TextEncoder TextMetrics TimeRanges Touch TouchEvent TouchList Transferable TransitionEvent TreeWalker TypeInfo UIEvent Uint16Array Uint32Array Uint8Array Uint8ClampedArray URL URLUtils URLUtilsReadOnly
|
||||
" }}}
|
||||
@@ -172,25 +179,32 @@ endif
|
||||
"}}}
|
||||
" Function and arguments highlighting {{{
|
||||
syntax keyword javaScriptFuncKeyword function contained
|
||||
syntax region javascriptFuncExp start=/\w\+\s\==\s\=function/ end="\([^)]*\)" contains=javascriptFuncEq,javascriptFuncKeyword,javascriptFuncArg keepend
|
||||
syntax match javaScriptFuncArg "\(([^()]*)\)" contains=javaScriptParens,javaScriptFuncComma contained
|
||||
syntax region javaScriptFuncExp start=/\w\+\s\==\s\=function\>/ end="\([^)]*\)" contains=javaScriptFuncEq,javaScriptFuncKeyword,javaScriptFuncArg keepend
|
||||
syntax match javaScriptFuncArg "\(([^()]*)\)" contains=javaScriptParens,javaScriptFuncComma,javaScriptComment contained
|
||||
syntax match javaScriptFuncComma /,/ contained
|
||||
syntax match javascriptFuncEq /=/ contained
|
||||
syntax region javaScriptFuncDef start="function" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend
|
||||
syntax match javaScriptFuncEq /=/ contained
|
||||
syntax region javaScriptFuncDef start="\<function\>" end="\([^)]*\)" contains=javaScriptFuncKeyword,javaScriptFuncArg keepend
|
||||
syntax match javaScriptObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=javaScriptFunctionKey
|
||||
syntax match javaScriptFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ contained
|
||||
"}}}
|
||||
" Braces, Parens, symbols, colons {{{
|
||||
syn match javaScriptBraces "[{}\[\]]"
|
||||
syn match javaScriptParens "[()]"
|
||||
syn match javaScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
|
||||
syn match javaScriptEndColons "[;,]"
|
||||
syn match javaScriptLogicSymbols "\(&&\)\|\(||\)"
|
||||
syntax match javaScriptBraces "[{}\[\]]"
|
||||
syntax match javaScriptParens "[()]"
|
||||
syntax match javaScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
|
||||
syntax match javaScriptEndColons "[;,]"
|
||||
syntax match javaScriptLogicSymbols "\(&&\)\|\(||\)"
|
||||
"}}}
|
||||
" ES6 String Interpolation {{{
|
||||
syntax match javaScriptTemplateDelim "\${\|}" contained
|
||||
syntax region javaScriptTemplateVar start=+${+ end=+}+ contains=javaScriptTemplateDelim keepend
|
||||
syntax region javaScriptTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=javaScriptTemplateVar,javaScriptSpecial keepend
|
||||
"}}}
|
||||
" JavaScriptFold Function {{{
|
||||
|
||||
function! JavaScriptFold()
|
||||
setl foldmethod=syntax
|
||||
setl foldlevelstart=1
|
||||
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
|
||||
syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
@@ -210,6 +224,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
HiLink javaScriptLogicSymbols Boolean
|
||||
HiLink javaScriptBraces Function
|
||||
HiLink javaScriptParens Operator
|
||||
HiLink javaScriptTemplateDelim Operator
|
||||
|
||||
HiLink javaScriptComment Comment
|
||||
HiLink javaScriptLineComment Comment
|
||||
@@ -222,6 +237,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
|
||||
HiLink javaScriptString String
|
||||
HiLink javaScriptRegexpString String
|
||||
HiLink javaScriptTemplateString String
|
||||
|
||||
HiLink javaScriptNumber Number
|
||||
HiLink javaScriptFloat Number
|
||||
@@ -266,6 +282,16 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
|
||||
HiLink javaScriptBrowserObjects Constant
|
||||
|
||||
HiLink javaScriptLocalStorageObjects Constant
|
||||
HiLink javaScriptLocalStorageMethods Type
|
||||
|
||||
HiLink javaScriptFetchAPIObjects Constant
|
||||
HiLink javaScriptFetchAPIMethods Type
|
||||
HiLink javaScriptFetchAPIProperties Label
|
||||
|
||||
HiLink javaScriptJSONObject Constant
|
||||
HiLink javaScriptJSONMethods Type
|
||||
|
||||
HiLink javaScriptDOMObjects Constant
|
||||
HiLink javaScriptDOMMethods Type
|
||||
HiLink javaScriptDOMProperties Label
|
||||
@@ -276,10 +302,10 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
|
||||
HiLink javaScriptFuncKeyword Function
|
||||
HiLink javaScriptFuncDef PreProc
|
||||
HiLink javascriptFuncExp Title
|
||||
HiLink javaScriptFuncExp Title
|
||||
HiLink javaScriptFuncArg Special
|
||||
HiLink javascriptFuncComma Operator
|
||||
HiLink javascriptFuncEq Operator
|
||||
HiLink javaScriptFuncComma Operator
|
||||
HiLink javaScriptFuncEq Operator
|
||||
|
||||
HiLink javaScriptHtmlEvents Constant
|
||||
HiLink javaScriptHtmlElemProperties Label
|
||||
@@ -302,3 +328,5 @@ let b:current_syntax = "javascript"
|
||||
if main_syntax == 'javascript'
|
||||
unlet main_syntax
|
||||
endif
|
||||
syntax region jsInJsdocExample matchgroup=Snip start="^\s*\* @example" end="\(^\s*\* [^[:space:]]\)\@=" containedin=@javaScriptComment contains=@javaScriptAll
|
||||
hi link Snip SpecialComment
|
||||
|
||||
Reference in New Issue
Block a user