syntax: sh: colorize options only when they are preceded by whitespace

To prevent any filenames containing hyphens getting partially colored.

Reported-by: Brand Huntsman <alpha@qzx.com>
master
Benno Schulenberg 2018-03-30 10:45:04 +02:00
parent 0cd833e64b
commit cf1129a8b4
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>" color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options. # Short and long options.
color brightmagenta "-[A-Za-z]\>" "--[A-Za-z-]+\>" color brightmagenta "[[:blank:]]-[A-Za-z]\>" "[[:blank:]]--[A-Za-z-]+\>"
# Common commands. # 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 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)\>"