From 441f1a8aad75b6f3e80cdd05e2307896e162dd82 Mon Sep 17 00:00:00 2001 From: Mark Lodato Date: Wed, 30 Oct 2013 00:46:17 -0400 Subject: [PATCH] highlight array assignments of the form x[y]=... This code is more lenient than bash. Examples: $ x[y[]= zsh: no matches found: x[y[]= $ x[][]= zsh: no matches found: x[][]= The proper solution is to look inside the [...] and make sure that all unescaped/unquoted square brackes are matched, but that is a heck of a lot more complicated than this simple 8-character patch. --- highlighters/main/main-highlighter.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index e2abcc1..f69e656 100755 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -153,7 +153,7 @@ _zsh_highlight_main_highlighter() _zsh_highlight_main_highlighter_check_assign() { setopt localoptions extended_glob - [[ $arg == [[:alpha:]_]([[:alnum:]_])#=* ]] + [[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])=* ]] } # Check if the argument is a path.