From 75e850577d0b85d39217066139fafff1ba0376df Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 17 Feb 2017 22:50:11 -0700 Subject: [PATCH] Gracefully handle being sourced multiple times Should fix #126 --- src/bind.zsh | 1 + zsh-autosuggestions.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bind.zsh b/src/bind.zsh index 9729873..e2ca5c9 100644 --- a/src/bind.zsh +++ b/src/bind.zsh @@ -16,6 +16,7 @@ _zsh_autosuggest_bind_widget() { # User-defined widget user:*) + zle -l "$prefix$widget" && zle -N "$widget" ${widgets[$prefix$widget]#*:} zle -N $prefix$widget ${widgets[$widget]#*:} ;; diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 2e612ca..df4f4a5 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -150,6 +150,7 @@ _zsh_autosuggest_bind_widget() { # User-defined widget user:*) + zle -l "$prefix$widget" && zle -N "$widget" ${widgets[$prefix$widget]#*:} zle -N $prefix$widget ${widgets[$widget]#*:} ;;