| From 5a6a9c107148162f47032b03af3f393c3888c5df Mon Sep 17 00:00:00 2001 |
| From: Mike Frysinger <vapier@gentoo.org> |
| Date: Tue, 28 Feb 2012 11:14:33 -0500 |
| Subject: [PATCH] shell syntax: major updates |
| |
| Highlight more shell builtins and common commands. |
| |
| Rewrite the variable highlighting to be more exact and handle cases where |
| string operations are used. |
| |
| Signed-off-by: Mike Frysinger <vapier@gentoo.org> |
| --- |
| doc/syntax/sh.nanorc | 13 +++++++++---- |
| 1 file changed, 9 insertions(+), 4 deletions(-) |
| |
| diff --git a/doc/syntax/sh.nanorc b/doc/syntax/sh.nanorc |
| index f660105..a664ef6 100644 |
| --- a/doc/syntax/sh.nanorc |
| +++ b/doc/syntax/sh.nanorc |
| @@ -4,12 +4,17 @@ syntax "sh" "\.sh$" |
| magic "(POSIX|Bourne.*) shell script text" |
| header "^#!.*/(ba|k|pdk)?sh[-0-9_]*" |
| icolor brightgreen "^[0-9A-Z_]+\(\)" |
| -color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>" |
| -color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" |
| +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 brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>" |
| -icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?" |
| +color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|echo|env|grep|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|umask|unset)\>" |
| +# Basic variable names (no braces) |
| +color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*" |
| +# More complicated variable names; handles braces |
| +# and replacements and arrays |
| +color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})" |
| color cyan "(^|[[:space:]])#.*$" |
| color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'" |
| color ,green "[[:space:]]+$" |
| -- |
| 1.7.9.7 |
| |