annotate nanorc.d/sh.nanorc @ 93:411e0a1c4382

Hide warnings and solve cross-version compatibility
author IBBoard <dev@ibboard.co.uk>
date Mon, 02 Apr 2018 19:21:36 +0100
parents 5f2c5800fa8a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 ## Here is an example for Bourne shell scripts.
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
92
5f2c5800fa8a Fix small differences with older Nano on the server
IBBoard <dev@ibboard.co.uk>
parents: 89
diff changeset
3 syntax "sh" "\.sh$"
89
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 magic "(POSIX|Bourne-Again) shell script.*text"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 linter dash -n
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 comment "#"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 icolor cyan "^[0-9A-Z_]+\(\)"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 color cyan "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 color cyan "\<(declare|eval|exec|export|let|local)[[:space:]]\>"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 color cyan "[{}():;|`$<>!=&\\]" "(\]|\[)"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 color cyan "(function )?[a-zA-Z0-9_]+[[:space:]]*\(\)"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 color cyan "-[Ldefgruwx]\>"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 color red "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 color red "&&|\|\|"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 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)\>"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 # Basic variable names (no braces).
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 color magenta "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 # More complicated variable names; handles braces and replacements and arrays.
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 color magenta "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 # Strings.
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 color yellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 # Comments.
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 color green "(^|[[:space:]])#.*$"
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 # Trailing whitespace.
a5810e6bed7e Improve nano shell colouring
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 color ,green "[[:space:]]+$"