From 0bce5ba4d981311c0a98b2e1509cac92993fd47d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 28 Mar 2018 14:30:07 +0200 Subject: [PATCH] syntax: sh: color options distinctively, and color also long options Also add some comments, and accept hyphens in function names. --- syntax/sh.nanorc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/syntax/sh.nanorc b/syntax/sh.nanorc index cf251858..7295029b 100644 --- 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\>"