nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] add javascript syntax highlighting


From: Mike Frysinger
Subject: [Nano-devel] [PATCH] add javascript syntax highlighting
Date: Sun, 23 Mar 2014 16:41:58 -0400

Based on the C syntax.
---
 doc/syntax/javascript.nanorc | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 doc/syntax/javascript.nanorc

diff --git a/doc/syntax/javascript.nanorc b/doc/syntax/javascript.nanorc
new file mode 100644
index 0000000..d68da5d
--- /dev/null
+++ b/doc/syntax/javascript.nanorc
@@ -0,0 +1,21 @@
+## Here is an example for Javascript.
+##
+syntax "javascript" "\.js$"
+color brightred "\<[A-Z_][0-9A-Z_]+\>"
+color green "\<(const|function|let|this|typeof|var|void)\>"
+color brightyellow "\<(for|if|while|with|do|else|case|default|switch)\>"
+color brightyellow "\<(export|try|throw|catch|new|delete)\>"
+color magenta "\<(continue|break|return|yield)\>"
+color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" 
"'\\x[0-9A-Fa-f]{1,2}'"
+
+## String highlighting.  You will in general want your comments and
+## strings to come last, because syntax highlighting rules will be
+## applied in the order they are read in.
+color brightyellow "<[^=       ]*>" ""(\\.|[^"])*"" "'(\\.|[^'])*'"
+
+## Comment highlighting
+color brightblue "//.*"
+color brightblue start="/\*" end="\*/"
+
+## Trailing whitespace
+color ,green "[[:space:]]+$"
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]