From 74949c2d9198dc8be9d1f3c6bc74c16a35098218 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 1 Dec 2016 09:07:37 +0000 Subject: [PATCH] driver: Don't undefine aliases that begin with a '+', to workaround an upstream bug. Fixes #392. --- zsh-syntax-highlighting.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index fff47d1..52d35f2 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -28,8 +28,12 @@ # ------------------------------------------------------------------------------------------------- # First of all, ensure predictable parsing. -zsh_highlight__aliases=`builtin alias -L` -builtin unalias -m '*' +zsh_highlight__aliases=`builtin alias -Lm '[^+]*'` +# In zsh <= 5.2, `alias -L` emits aliases that begin with a plus sign ('alias -- +foo=42') +# them without a '--' guard, so they don't round trip. +# +# Hence, we exclude them from unaliasing: +builtin unalias -m '[^+]*' # Set $0 to the expected value, regardless of functionargzero. 0=${(%):-%N}