From bf15d2085d1cfc7b5c71da3e7de17c4234cbd29c Mon Sep 17 00:00:00 2001 From: Guido Date: Thu, 16 Jun 2011 23:57:39 -0700 Subject: [PATCH] Prevent preexec() from being overridden by "_zhs_highlight". Note the spelling of "zhs" --- zsh-syntax-highlighting.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 60eb864..c05a638 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -28,6 +28,17 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------------------------- +# Workaround to overriding of preexec() +# ------------------------------------------------------------------------------------------------- + +# For some reason unidentified yet, someting goes wrong when sourcing this script twice +# The second time prexec() gets overwritten by "_zhs_highlight". This is a miss-spelled +# command which produces an error. +# +# The widget prexec() does not require modification anyway. So make a copy it here, which +# will be restored at the end of this script. +_zsh_highlight_old_preexec_definition=$functions[preexec] # ------------------------------------------------------------------------------------------------- # Core highlighting update system @@ -184,3 +195,6 @@ if [[ $#functions[zle-line-init] -eq 0 ]]; then fi zle -N zle-line-init + +# Restore preexec +functions[preexec]="$_zsh_highlight_old_preexec_definition"