From 89e1243c4367b9357ee87be2a7ae978395d8287a Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Fri, 22 Apr 2016 11:35:37 +0600 Subject: [PATCH] play well with zsh-syntax-highlight --- src/bind.zsh | 4 ++++ src/start.zsh | 1 + zsh-autosuggestions.zsh | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/bind.zsh b/src/bind.zsh index b1e68f1..aa03dc7 100644 --- a/src/bind.zsh +++ b/src/bind.zsh @@ -9,6 +9,10 @@ _zsh_autosuggest_bind_widget() { local autosuggest_action=$2 local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX + if zle -l $prefix$widget; then + return + fi + # Save a reference to the original widget case $widgets[$widget] in # Already bound diff --git a/src/start.zsh b/src/start.zsh index 54f5bb8..11c1870 100644 --- a/src/start.zsh +++ b/src/start.zsh @@ -10,4 +10,5 @@ _zsh_autosuggest_start() { } autoload -Uz add-zsh-hook +add-zsh-hook -d precmd _zsh_autosuggest_start add-zsh-hook precmd _zsh_autosuggest_start diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 17d1eaa..dc2755c 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -119,6 +119,10 @@ _zsh_autosuggest_bind_widget() { local autosuggest_action=$2 local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX + if zle -l $prefix$widget; then + return + fi + # Save a reference to the original widget case $widgets[$widget] in # Already bound @@ -426,4 +430,5 @@ _zsh_autosuggest_start() { } autoload -Uz add-zsh-hook +add-zsh-hook -d precmd _zsh_autosuggest_start add-zsh-hook precmd _zsh_autosuggest_start