From 647ac1ac00298cb2e267dfe998ab0651f537015b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Mar 2012 12:19:53 -0400 Subject: [PATCH] Return 1 when a file fails to load --- completion.zsh | 2 +- init.zsh | 6 ++++-- keyboard.zsh | 4 ++-- plugins/gpg-agent/init.zsh | 2 +- plugins/ssh-agent/init.zsh | 2 +- terminal.zsh | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/completion.zsh b/completion.zsh index 02d2561..dc75c6f 100644 --- a/completion.zsh +++ b/completion.zsh @@ -8,7 +8,7 @@ # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then - return + return 1 fi setopt COMPLETE_IN_WORD # Complete from both ends of a word. diff --git a/init.zsh b/init.zsh index bb6bd50..b2a0f07 100644 --- a/init.zsh +++ b/init.zsh @@ -53,8 +53,6 @@ autoload -Uz zmv # Source plugins defined in ~/.zshrc. for plugin in "$plugins[@]"; do - zstyle ":omz:plugin:$plugin" enable 'yes' - if [[ ! -d "${0:h}/plugins/$plugin" ]]; then print "omz: no such plugin: $plugin" >&2 fi @@ -62,6 +60,10 @@ for plugin in "$plugins[@]"; do if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then source "${0:h}/plugins/$plugin/init.zsh" fi + + if (( $? == 0 )); then + zstyle ":omz:plugin:$plugin" enable 'yes' + fi done unset plugin plugins diff --git a/keyboard.zsh b/keyboard.zsh index c8c0e6d..fc3969b 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -7,7 +7,7 @@ # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then - return + return 1 fi # The default styles. @@ -65,7 +65,7 @@ keyinfo=( for key in "$keyinfo[@]"; do if [[ -z "$key" ]]; then print "omz: one or more keys are non-bindable" >&2 - return + return 1 fi done diff --git a/plugins/gpg-agent/init.zsh b/plugins/gpg-agent/init.zsh index 132aa7f..70e68e3 100644 --- a/plugins/gpg-agent/init.zsh +++ b/plugins/gpg-agent/init.zsh @@ -7,7 +7,7 @@ # if (( ! $+commands[gpg-agent] )); then - return + return 1 fi _gpg_env="$HOME/.gnupg/gpg-agent.env" diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 5cc43e7..8d9daf7 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -21,7 +21,7 @@ # if (( ! $+commands[ssh-agent] )); then - return + return 1 fi _ssh_agent_env="${HOME}/.ssh/environment-${HOST}" diff --git a/terminal.zsh b/terminal.zsh index a83fa98..7679d83 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -8,7 +8,7 @@ # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then - return + return 1 fi # Set the GNU Screen window number.