1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 12:20:07 +00:00

simplify code

This commit is contained in:
romkatv 2019-07-28 10:34:06 +02:00
parent 1731b69f5f
commit ebd32c8cbe

View file

@ -290,15 +290,17 @@ function _p9k_ask_overwrite() {
function _p9k_generate_config() { function _p9k_generate_config() {
local base && base="$(< $_p9k_root_dir/config/p10k-$_p9k_style.zsh)" || return local base && base="$(< $_p9k_root_dir/config/p10k-$_p9k_style.zsh)" || return
local lines=("${(@f)base}") 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 if [[ $POWERLEVEL9K_MODE == (powerline|compatible) && $_p9k_style == lean ]]; then
local exp="''" _p9k_sub VISUAL_IDENTIFIER_EXPANSION "''"
elif (( _p9k_caps_narrow_icons )); then elif (( _p9k_caps_narrow_icons )); then
local exp="'\${P9K_VISUAL_IDENTIFIER// }'" _p9k_sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER// }'"
else else
local exp="'\${P9K_VISUAL_IDENTIFIER}'" _p9k_sub VISUAL_IDENTIFIER_EXPANSION "'\${P9K_VISUAL_IDENTIFIER}'"
fi fi
lines=("${(@)lines/# typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=*/ typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=$exp}")
if (( _p9k_lines == 1 )); then if (( _p9k_lines == 1 )); then
local -a tmp local -a tmp
local line local line