changeset 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 f2d500466492
children c9adf6fc4b61
files nanorc nanorc.d/javascript.nanorc
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/nanorc	Tue Apr 03 12:53:35 2018 +0100
+++ b/nanorc	Tue Apr 03 15:03:46 2018 +0100
@@ -29,6 +29,9 @@
 ## CSS
 include "~/.nanorc.d/css.nanorc"
 
+## JavaScript
+include "~/.nanorc.d/javascript.nanorc"
+
 ## Bourne shell scripts
 include "~/.nanorc.d/sh.nanorc"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nanorc.d/javascript.nanorc	Tue Apr 03 15:03:46 2018 +0100
@@ -0,0 +1,27 @@
+## Syntax highlighting for Javascript.
+
+syntax javascript "\.js$"
+comment "//"
+
+# Declarational stuff.
+color cyan "\<(async|class|const|extends|function|let|this|typeof|var|void)\>"
+# Flow control and special keywords.
+color cyan "\<(do|while|if|else|switch|case|default|for|each|in|of|with)\>"
+color cyan "\<(await|export|import|throw|try|catch|finally|new|delete)\>"
+# "Exit" points.
+color magenta "\<(break|continue|return|yield|this)\>"
+# Operators - note, we require proper spacing to prevent false positives
+color red "(^|[[:space:]])(&&|\|\||>=?|<=?|===?|!==?)([[:space:]]|$)"
+color red "!"
+
+# Strings.
+color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
+# And regex
+color yellow "/.*[^\\]/"
+
+# Comments.
+color green "(^|[[:space:]])//.*"
+color green start="/\*" end="\*/"
+
+# Trailing whitespace.
+color ,green "[[:space:]]+$"