commit 0bce5ba4d981311c0a98b2e1509cac92993fd47d
parent f9415e347aa036fcab2ec44b0fad96d084336b46
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 28 Mar 2018 14:30:07 +0200
syntax: sh: color options distinctively, and color also long options
Also add some comments, and accept hyphens in function names.
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/syntax/sh.nanorc b/syntax/sh.nanorc
@@ -6,12 +6,19 @@ magic "(POSIX|Bourne-Again) shell script.*text"
linter dash -n
comment "#"
-icolor brightgreen "^[0-9A-Z_]+\(\)"
+# Function declarations.
+color brightgreen "^[A-Za-z0-9_-]+\(\)"
+
+# Keywords, symbols, and comparisons.
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
color green "\<(declare|eval|exec|export|let|local)\>"
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
-color green "-[Ldefgruwx]\>"
-color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
+color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
+
+# Short and long options.
+color brightmagenta "-[A-Za-z]\>" "--[A-Za-z-]+\>"
+
+# Common commands.
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"
color normal "[.-]tar\>"