From aa606e6cb0cb6ae852cca343fbffe72ed8015a1c Mon Sep 17 00:00:00 2001 From: romkatv Date: Thu, 3 Oct 2019 14:50:08 +0200 Subject: [PATCH] don't print options when no_aliases, no_sh_glob and brace_expand are all set --- config/p10k-classic.zsh | 2 +- config/p10k-lean.zsh | 2 +- config/p10k-pure.zsh | 2 +- powerlevel9k.zsh-theme | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 35cfac1e..8c1e36f1 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -761,5 +761,5 @@ typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}' } -setopt ${p10k_config_opts[@]} +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} 'builtin' 'unset' 'p10k_config_opts' diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 96aba8e3..4693b363 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -740,5 +740,5 @@ typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}' } -setopt ${p10k_config_opts[@]} +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} 'builtin' 'unset' 'p10k_config_opts' diff --git a/config/p10k-pure.zsh b/config/p10k-pure.zsh index 61a2f5a1..a7ce1f5b 100644 --- a/config/p10k-pure.zsh +++ b/config/p10k-pure.zsh @@ -100,5 +100,5 @@ typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=yellow } -setopt ${p10k_config_opts[@]} +(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} 'builtin' 'unset' 'p10k_config_opts' diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8a0dc15b..9d2847ce 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -10,12 +10,12 @@ # https://github.com/robbyrussell/oh-my-zsh/blob/74177c5320b2a1b2f8c4c695c05984b57fd7c6ea/themes/agnoster.zsh-theme ################################################################ -if [[ -o 'aliases' ]]; then - 'builtin' 'unsetopt' 'aliases' - local __p9k_restore_aliases=1 -else - local __p9k_restore_aliases=0 -fi +# Temporarily change options. +'builtin' 'local' '-a' '_p9k_src_opts' +[[ ! -o 'aliases' ]] || _p9k_src_opts+=('aliases') +[[ ! -o 'sh_glob' ]] || _p9k_src_opts+=('sh_glob') +[[ ! -o 'no_brace_expand' ]] || _p9k_src_opts+=('no_brace_expand') +'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' typeset -g __p9k_root_dir="${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}" @@ -34,5 +34,5 @@ typeset -g __p9k_root_dir="${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}" source $__p9k_root_dir/internal/p10k.zsh || true } -(( ! __p9k_restore_aliases )) || setopt aliases -'builtin' 'unset' '__p9k_restore_aliases' +(( ${#_p9k_src_opts} )) && setopt ${_p9k_src_opts[@]} +'builtin' 'unset' '_p9k_src_opts'