Merge branch 'master' into worker

pull/445/head
romkatv 5 years ago
commit 80e8e46fe5

@ -182,7 +182,7 @@
# POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below.
typeset -g POWERLEVEL9K_SHOW_RULER=false typeset -g POWERLEVEL9K_SHOW_RULER=false
typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·' typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·'
typeset -g POWERLEVEL9K_RULER_FOREGROUND= typeset -g POWERLEVEL9K_RULER_FOREGROUND=7
# Filler between left and right prompt on the first prompt line. You can set it to '·' or '─' # Filler between left and right prompt on the first prompt line. You can set it to '·' or '─'
# to make it easier to see the alignment between left and right prompt and to separate prompt # to make it easier to see the alignment between left and right prompt and to separate prompt
@ -193,7 +193,7 @@
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler. # The color of the filler.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND= typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=7
# Add a space between the end of left prompt and the filler. # Add a space between the end of left prompt and the filler.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' '
# Add a space between the filler and the start of right prompt. # Add a space between the filler and the start of right prompt.
@ -224,7 +224,10 @@
# Prompt symbol in overwrite vi mode. # Prompt symbol in overwrite vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
# No line terminator if prompt_char is the last segment.
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
# No line introducer if prompt_char is the first segment.
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
##################################[ dir: current directory ]################################## ##################################[ dir: current directory ]##################################
# Default current directory color. # Default current directory color.

@ -224,7 +224,10 @@
# Prompt symbol in overwrite vi mode. # Prompt symbol in overwrite vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶'
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
# No line terminator if prompt_char is the last segment.
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
# No line introducer if prompt_char is the first segment.
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
##################################[ dir: current directory ]################################## ##################################[ dir: current directory ]##################################
# Default current directory color. # Default current directory color.

@ -3960,7 +3960,9 @@ function instant_prompt_direnv() {
fi fi
} }
_p9k_preexec() { # Use two preexec hooks to survive https://github.com/MichaelAquilina/zsh-you-should-use with
# YSU_HARDCORE=1. See https://github.com/romkatv/powerlevel10k/issues/427.
_p9k_preexec1() {
if (( $+_p9k_real_zle_rprompt_indent )); then if (( $+_p9k_real_zle_rprompt_indent )); then
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent
@ -3969,6 +3971,10 @@ _p9k_preexec() {
fi fi
unset _p9k_real_zle_rprompt_indent unset _p9k_real_zle_rprompt_indent
fi fi
(( $+functions[TRAPINT] )) || trap - INT
}
_p9k_preexec2() {
_p9k__preexec_cmd=$2 _p9k__preexec_cmd=$2
_p9k__timer_start=EPOCHREALTIME _p9k__timer_start=EPOCHREALTIME
} }
@ -4896,8 +4902,7 @@ _p9k_precmd_impl() {
_p9k__timer_start=0 _p9k__timer_start=0
_p9k__region_active=0 _p9k__region_active=0
unset _p9k__line_finished unset _p9k__line_finished _p9k__preexec_cmd
unset _p9k__preexec_cmd
_p9k__keymap=main _p9k__keymap=main
_p9k__zle_state=insert _p9k__zle_state=insert
@ -4911,11 +4916,17 @@ _p9k_precmd_impl() {
_p9k_set_prompt _p9k_set_prompt
_p9k_refresh_reason='' _p9k_refresh_reason=''
if [[ $precmd_functions[1] != _p9k_do_nothing && $precmd_functions[(I)_p9k_do_nothing] != 0 ]]; then
precmd_functions=(_p9k_do_nothing ${(@)precmd_functions:#_p9k_do_nothing})
fi
if [[ $precmd_functions[-1] != _p9k_precmd && $precmd_functions[(I)_p9k_precmd] != 0 ]]; then if [[ $precmd_functions[-1] != _p9k_precmd && $precmd_functions[(I)_p9k_precmd] != 0 ]]; then
precmd_functions=(${(@)precmd_functions:#_p9k_precmd} _p9k_precmd) precmd_functions=(${(@)precmd_functions:#_p9k_precmd} _p9k_precmd)
fi fi
if [[ $precmd_functions[1] != _p9k_do_nothing && $precmd_functions[(I)_p9k_do_nothing] != 0 ]]; then if [[ $preexec_functions[1] != _p9k_preexec1 && $preexec_functions[(I)_p9k_preexec1] != 0 ]]; then
precmd_functions=(_p9k_do_nothing ${(@)precmd_functions:#_p9k_do_nothing}) preexec_functions=(_p9k_preexec1 ${(@)preexec_functions:#_p9k_preexec1})
fi
if [[ $preexec_functions[-1] != _p9k_preexec2 && $preexec_functions[(I)_p9k_preexec2] != 0 ]]; then
preexec_functions=(${(@)preexec_functions:#_p9k_preexec2} _p9k_preexec2)
fi fi
} }
@ -6738,7 +6749,7 @@ prompt_powerlevel9k_setup() {
setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases
prompt_powerlevel9k_teardown prompt_powerlevel9k_teardown
__p9k_enabled=1 __p9k_enabled=1
add-zsh-hook preexec _p9k_preexec typeset -ga preexec_functions=(_p9k_preexec1 $preexec_functions _p9k_preexec2)
typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd) typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd)
} }

@ -34,7 +34,6 @@ local -ri wizard_columns=$((COLUMNS < 80 ? COLUMNS : 80))
local -ri prompt_indent=2 local -ri prompt_indent=2
local -ra bg_color=(240 238 236 234) local -ra bg_color=(240 238 236 234)
local -ra frame_color=(244 242 240 238)
local -ra sep_color=(248 246 244 242) local -ra sep_color=(248 246 244 242)
local -ra prefix_color=(250 248 246 244) local -ra prefix_color=(250 248 246 244)
@ -64,13 +63,13 @@ local -ra lean_right=(
) )
local -ra lean_8colors_left=( local -ra lean_8colors_left=(
'╭─ ' '${extra_icons[1]:+$extra_icons[1] }%4F$extra_icons[2]%4F~/src%f $prefixes[1]%2F$extra_icons[3]master%f ' '%$frame_color[$color]F╭─ ' '${extra_icons[1]:+$extra_icons[1] }%4F$extra_icons[2]%4F~/src%f $prefixes[1]%2F$extra_icons[3]master%f '
'╰─ ' '%2F%f ${buffer:-█}' '%$frame_color[$color]F╰─' '%2F%f ${buffer:-█}'
) )
local -ra lean_8colors_right=( local -ra lean_8colors_right=(
' $prefixes[2]%3F$extra_icons[4]5s%f${show_time:+ $prefixes[3]%6F$extra_icons[5]16:23:42%f}' ' ─╮' ' $prefixes[2]%3F$extra_icons[4]5s%f${show_time:+ $prefixes[3]%6F$extra_icons[5]16:23:42%f}' ' %$frame_color[$color]F─╮%f'
'' ' ─╯' '' ' %$frame_color[$color]F─╯%f'
) )
local -ra classic_left=( local -ra classic_left=(
@ -151,8 +150,7 @@ function print_prompt() {
(( num_lines == 2 && i == 1 )) && local fill=$gap_char || local fill=' ' (( num_lines == 2 && i == 1 )) && local fill=$gap_char || local fill=' '
print -n -- ${(pl:$prompt_indent:: :)} print -n -- ${(pl:$prompt_indent:: :)}
print -nP -- $l print -nP -- $l
[[ $style == lean_8colors ]] && local gap_color='%f' || local gap_color="%$frame_color[$color]F" print -nP -- "%$frame_color[$color]F${(pl:$gap::$fill:)}%f"
print -nP -- "$gap_color${(pl:$gap::$fill:)}%f"
print -P -- $r print -P -- $r
done done
} }
@ -631,7 +629,12 @@ function ask_color_scheme() {
q) quit;; q) quit;;
r) return 1;; r) return 1;;
1) style=lean; break;; 1) style=lean; break;;
2) style=lean_8colors; break;; 2)
style=lean_8colors
frame_color=(0 7 2 4)
color_name=(Black White Green Blue)
break
;;
esac esac
done done
} }
@ -647,19 +650,19 @@ function ask_color() {
clear clear
flowing -c "%BPrompt Color%b" flowing -c "%BPrompt Color%b"
print -n $nl print -n $nl
print -P "%B(1) Lightest.%b" print -P "%B(1) $color_name[1].%b"
print -n $nl print -n $nl
color=1 print_prompt color=1 print_prompt
print -P "" print -P ""
print -P "%B(2) Light.%b" print -P "%B(1) $color_name[2].%b"
print -n $nl print -n $nl
color=2 print_prompt color=2 print_prompt
print -P "" print -P ""
print -P "%B(3) Dark.%b" print -P "%B(1) $color_name[3].%b"
print -n $nl print -n $nl
color=3 print_prompt color=3 print_prompt
print -P "" print -P ""
print -P "%B(4) Darkest.%b" print -P "%B(1) $color_name[4].%b"
print -n $nl print -n $nl
color=4 print_prompt color=4 print_prompt
print -P "" print -P ""
@ -672,16 +675,14 @@ function ask_color() {
case $key in case $key in
q) quit;; q) quit;;
r) return 1;; r) return 1;;
1) color=1; options+=lightest; break;; [1-4]) color=$key; break;;
2) color=2; options+=light; break;;
3) color=3; options+=dark; break;;
4) color=4; options+=darkest; break;;
esac esac
done done
options+=${(L)color_name[color]}
} }
function ask_ornaments_color() { function ask_ornaments_color() {
[[ $style != (rainbow|lean) || $num_lines == 1 ]] && return [[ $style != (rainbow|lean*) || $num_lines == 1 ]] && return
[[ $gap_char == ' ' && $left_frame == 0 && $right_frame == 0 ]] && return [[ $gap_char == ' ' && $left_frame == 0 && $right_frame == 0 ]] && return
if [[ $LINES -lt 26 ]]; then if [[ $LINES -lt 26 ]]; then
local nl='' local nl=''
@ -695,19 +696,19 @@ function ask_ornaments_color() {
clear clear
flowing -c "%B${(j: & :)ornaments} Color%b" flowing -c "%B${(j: & :)ornaments} Color%b"
print -n $nl print -n $nl
print -P "%B(1) Lightest.%b" print -P "%B(1) $color_name[1].%b"
print -n $nl print -n $nl
color=1 print_prompt color=1 print_prompt
print -P "" print -P ""
print -P "%B(2) Light.%b" print -P "%B(2) $color_name[2].%b"
print -n $nl print -n $nl
color=2 print_prompt color=2 print_prompt
print -P "" print -P ""
print -P "%B(3) Dark.%b" print -P "%B(3) $color_name[3].%b"
print -n $nl print -n $nl
color=3 print_prompt color=3 print_prompt
print -P "" print -P ""
print -P "%B(4) Darkest.%b" print -P "%B(4) $color_name[4].%b"
print -n $nl print -n $nl
color=4 print_prompt color=4 print_prompt
print -P "" print -P ""
@ -720,12 +721,10 @@ function ask_ornaments_color() {
case $key in case $key in
q) quit;; q) quit;;
r) return 1;; r) return 1;;
1) color=1; options+=lightest; break;; [1-4]) color=$key; break;;
2) color=2; options+=light; break;;
3) color=3; options+=dark; break;;
4) color=4; options+=darkest; break;;
esac esac
done done
options+=${(L)color_name[color]}-ornaments
} }
function ask_time() { function ask_time() {
@ -1545,6 +1544,7 @@ function generate_config() {
sub LEFT_SUBSEGMENT_SEPARATOR "'$left_subsep'" sub LEFT_SUBSEGMENT_SEPARATOR "'$left_subsep'"
sub RIGHT_SUBSEGMENT_SEPARATOR "'$right_subsep'" sub RIGHT_SUBSEGMENT_SEPARATOR "'$right_subsep'"
fi fi
sub RULER_FOREGROUND $frame_color[$color]
sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color] sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'" sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'" sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
@ -1621,22 +1621,18 @@ function generate_config() {
fi fi
if [[ $style == lean* ]]; then if [[ $style == lean* ]]; then
if [[ $style == lean ]]; then sub RULER_FOREGROUND $frame_color[$color]
local c="%$frame_color[$color]F"
sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color] sub MULTILINE_FIRST_PROMPT_GAP_FOREGROUND $frame_color[$color]
else
local c=
fi
if (( right_frame )); then if (( right_frame )); then
sub MULTILINE_FIRST_PROMPT_SUFFIX "'$c─╮'" sub MULTILINE_FIRST_PROMPT_SUFFIX "'%$frame_color[$color]F─╮'"
sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'$c─┤'" sub MULTILINE_NEWLINE_PROMPT_SUFFIX "'%$frame_color[$color]F─┤'"
sub MULTILINE_LAST_PROMPT_SUFFIX "'$c─╯'" sub MULTILINE_LAST_PROMPT_SUFFIX "'%$frame_color[$color]F─╯'"
sub RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL "' '" sub RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL "' '"
fi fi
if (( left_frame )); then if (( left_frame )); then
sub MULTILINE_FIRST_PROMPT_PREFIX "'$c╭─'" sub MULTILINE_FIRST_PROMPT_PREFIX "'%$frame_color[$color]F╭─'"
sub MULTILINE_NEWLINE_PROMPT_PREFIX "'$c├─'" sub MULTILINE_NEWLINE_PROMPT_PREFIX "'%$frame_color[$color]F├─'"
sub MULTILINE_LAST_PROMPT_PREFIX "'$c╰─'" sub MULTILINE_LAST_PROMPT_PREFIX "'%$frame_color[$color]F╰─'"
sub LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL "' '" sub LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL "' '"
fi fi
fi fi
@ -1740,6 +1736,8 @@ while true; do
local -i num_lines=0 empty_line=0 color=2 left_frame=1 right_frame=1 transient_prompt=0 local -i num_lines=0 empty_line=0 color=2 left_frame=1 right_frame=1 transient_prompt=0
local -i cap_diamond=0 cap_python=0 cap_debian=0 cap_narrow_icons=0 cap_lock=0 local -i cap_diamond=0 cap_python=0 cap_debian=0 cap_narrow_icons=0 cap_lock=0
local -a extra_icons=('' '' '') local -a extra_icons=('' '' '')
local -a frame_color=(244 242 240 238)
local -a color_name=(Lightest Light Dark Darkest)
local -a prefixes=('' '') local -a prefixes=('' '')
local -a options=() local -a options=()

Loading…
Cancel
Save