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