nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

sh.nanorc (1611B)


      1 ## Syntax highlighting for Bourne shell scripts.
      2 
      3 ## Original author:  Mike Frysinger
      4 ## License:  GPL version 3 or newer
      5 
      6 syntax sh "(\.sh|(^|/|\.)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|(/etc/|(^|/)\.)profile)$"
      7 header "^#!.*/(((env|busybox)[[:blank:]]+)?(a|ba|c|da|k|mk|pdk|tc|z)?sh|openrc-run|runscript)\>"
      8 header "-\*-.*shell-script.*-\*-"
      9 magic "(POSIX|Bourne-Again) shell script.*text"
     10 comment "#"
     11 
     12 linter dash -n
     13 
     14 # Function declarations.
     15 color brightgreen "^[[:alnum:]_-]+\(\)"
     16 
     17 # Keywords, symbols, and comparisons.
     18 color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
     19 color green "\<(declare|eval|exec|export|let|local)\>"
     20 color green "[][{}():;|`$<>!=&\]"
     21 color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
     22 
     23 # Short and long options.
     24 color brightmagenta "[[:blank:]](-[[:alpha:]]|--\<[[:alpha:]-]+)\>"
     25 
     26 # Common commands.
     27 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)\>"
     28 color normal "[.-]tar\>"
     29 
     30 # Basic variable names (no braces).
     31 color brightred "\$([-@*#?$![:digit:]]|[[:alpha:]_][[:alnum:]_]*)"
     32 # More complicated variable names; handles braces and replacements and arrays.
     33 color brightred "\$\{[#!]?([-@*#?$!]|[[:digit:]]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:blank:]]*[[:alnum:]_]+[[:blank:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
     34 
     35 # Comments.
     36 color cyan "(^|[[:blank:]])#.*"
     37 
     38 # Strings.
     39 color brightyellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'"
     40 
     41 # Trailing whitespace.
     42 color ,green "[[:space:]]+$"