diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-07-28 11:34:06 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-07-28 11:34:06 +0300 |
commit | ebd32c8cbe079a90148f6f8b67bf371822a1af03 (patch) | |
tree | d184524a40ba9b1e8ce3b68da15d196a4495b3c7 /internal/wizard.zsh | |
parent | 1731b69f5f98f52e22b2a2962889bf6c3cfd2c90 (diff) |
simplify code
Diffstat (limited to 'internal/wizard.zsh')
-rwxr-xr-x | internal/wizard.zsh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh index d37a0add..3e1aee7f 100755 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -290,15 +290,17 @@ function _p9k_ask_overwrite() { function _p9k_generate_config() { local base && base="$(< $_p9k_root_dir/config/p10k-$_p9k_style.zsh)" || return local lines=("${(@f)base}") - lines=("${(@)lines/# typeset -g POWERLEVEL9K_MODE=*/ typeset -g POWERLEVEL9K_MODE=$POWERLEVEL9K_MODE}") + function _p9k_sub() { + lines=("${(@)lines/# typeset -g POWERLEVEL9K_$1=*/ typeset -g POWERLEVEL9K_$1=$2}") + } + _p9k_sub MODE $POWERLEVEL9K_MODE if [[ $POWERLEVEL9K_MODE == (powerline|compatible) && $_p9k_style == lean ]]; then - local exp="''" + _p9k_sub VISUAL_IDENTIFIER_EXPANSION "''" elif (( _p9k_caps_narrow_icons )); then - local exp="'\${P9K_VISUAL_IDENTIFIER// }'" + _p9k_sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'" else - local exp="'\${P9K_VISUAL_IDENTIFIER}'" + _p9k_sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'" fi - lines=("${(@)lines/# typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=*/ typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=$exp}") if (( _p9k_lines == 1 )); then local -a tmp local line |