annotate nanorc.d/javascript.nanorc @ 105:38e63e27f3da

Add JavaScript syntax highlighting based on stock config
author IBBoard <dev@ibboard.co.uk>
date Tue, 03 Apr 2018 15:03:46 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 ## Syntax highlighting for Javascript.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 syntax javascript "\.js$"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 comment "//"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 # Declarational stuff.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 color cyan "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 # Flow control and special keywords.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 color cyan "\<(do|while|if|else|switch|case|default|for|each|in|of|with)\>"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 color cyan "\<(await|export|import|throw|try|catch|finally|new|delete)\>"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 # "Exit" points.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 color magenta "\<(break|continue|return|yield|this)\>"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 # Operators - note, we require proper spacing to prevent false positives
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 color red "(^|[[:space:]])(&&|\|\||>=?|<=?|===?|!==?)([[:space:]]|$)"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 color red "!"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 # Strings.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 # And regex
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 color yellow "/.*[^\\]/"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 # Comments.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 color green "(^|[[:space:]])//.*"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 color green start="/\*" end="\*/"
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 # Trailing whitespace.
38e63e27f3da Add JavaScript syntax highlighting based on stock config
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 color ,green "[[:space:]]+$"