mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 13:30:07 +00:00
Merge branch 'master' into worker
This commit is contained in:
commit
ed2b83275b
2 changed files with 126 additions and 50 deletions
|
@ -30,6 +30,15 @@
|
||||||
# Unset all configuration options.
|
# Unset all configuration options.
|
||||||
unset -m 'POWERLEVEL9K_*'
|
unset -m 'POWERLEVEL9K_*'
|
||||||
|
|
||||||
|
# Prompt colors.
|
||||||
|
local grey=242
|
||||||
|
local red=1
|
||||||
|
local yellow=3
|
||||||
|
local blue=4
|
||||||
|
local magenta=5
|
||||||
|
local cyan=6
|
||||||
|
local white=7
|
||||||
|
|
||||||
# Left prompt segments.
|
# Left prompt segments.
|
||||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||||||
dir # current directory
|
dir # current directory
|
||||||
|
@ -56,9 +65,9 @@
|
||||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
||||||
|
|
||||||
# Magenta prompt symbol if the last command succeeded.
|
# Magenta prompt symbol if the last command succeeded.
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=magenta
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
|
||||||
# Red prompt symbol if the last command failed.
|
# Red prompt symbol if the last command failed.
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
||||||
# Default prompt symbol.
|
# Default prompt symbol.
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
||||||
# Prompt symbol in command vi mode.
|
# Prompt symbol in command vi mode.
|
||||||
|
@ -69,18 +78,18 @@
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
|
||||||
|
|
||||||
# Grey Python Virtual Environment.
|
# Grey Python Virtual Environment.
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=242
|
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
|
||||||
# Don't show Python version.
|
# Don't show Python version.
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
||||||
|
|
||||||
# Blue current directory.
|
# Blue current directory.
|
||||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=blue
|
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
|
||||||
|
|
||||||
# Context format when root: user@host. The first part white, the rest grey.
|
# Context format when root: user@host. The first part white, the rest grey.
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%7F%n%f%242F@%m%f'
|
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
|
||||||
# Context format when not root: user@host. The whole thing grey.
|
# Context format when not root: user@host. The whole thing grey.
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%242F%n@%m%f'
|
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
|
||||||
# Don't show context unless root or in SSH.
|
# Don't show context unless root or in SSH.
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
|
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
|
||||||
|
|
||||||
|
@ -91,10 +100,10 @@
|
||||||
# Duration format: 1d 2h 3m 4s.
|
# Duration format: 1d 2h 3m 4s.
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
||||||
# Yellow previous command duration.
|
# Yellow previous command duration.
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=yellow
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
|
||||||
|
|
||||||
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
|
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
|
||||||
typeset -g POWERLEVEL9K_VCS_FOREGROUND=242
|
typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
|
||||||
|
|
||||||
# Disable async loading indicator to make directories that aren't Git repositories
|
# Disable async loading indicator to make directories that aren't Git repositories
|
||||||
# indistinguishable from large Git repositories without known state.
|
# indistinguishable from large Git repositories without known state.
|
||||||
|
@ -105,7 +114,7 @@
|
||||||
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
||||||
|
|
||||||
# Cyan ahead/behind arrows.
|
# Cyan ahead/behind arrows.
|
||||||
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=cyan
|
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
|
||||||
# Don't show remote branch, current tag or stashes.
|
# Don't show remote branch, current tag or stashes.
|
||||||
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
|
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
|
||||||
# Don't show the branh icon.
|
# Don't show the branh icon.
|
||||||
|
|
|
@ -33,6 +33,8 @@ local -ri wizard_columns=$((COLUMNS < 80 ? COLUMNS : 80))
|
||||||
|
|
||||||
local -ri prompt_indent=2
|
local -ri prompt_indent=2
|
||||||
|
|
||||||
|
local -rA pure_original=(grey 242 red 1 yellow 3 blue 4 magenta 5 cyan 6 white 7)
|
||||||
|
local -rA pure_snazzy=(grey 242 red '#FF5C57' yellow '#F3F99D' blue '#57C7FF' magenta '#FF6AC1' cyan '#9AEDFE' white '#F1F1F0')
|
||||||
local -ra bg_color=(240 238 236 234)
|
local -ra bg_color=(240 238 236 234)
|
||||||
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)
|
||||||
|
@ -83,8 +85,8 @@ local -ra classic_right=(
|
||||||
)
|
)
|
||||||
|
|
||||||
local -ra pure_left=(
|
local -ra pure_left=(
|
||||||
'' '%4F~/src%f %242Fmaster%f %3F5s%f'
|
'' '%F{$pure_color[blue]}~/src%f %F{$pure_color[grey]}master%f %F{$pure_color[yellow]}5s%f'
|
||||||
'' '%5F❯%f ${buffer:-█}'
|
'' '%F{$pure_color[magenta]}❯%f ${buffer:-█}'
|
||||||
)
|
)
|
||||||
|
|
||||||
local -ra pure_right=(
|
local -ra pure_right=(
|
||||||
|
@ -131,8 +133,10 @@ function print_prompt() {
|
||||||
left=($left[2] $left[4])
|
left=($left[2] $left[4])
|
||||||
right=($right[1] $right[3])
|
right=($right[1] $right[3])
|
||||||
else
|
else
|
||||||
[[ $style == lean_8colors ]] && local green=2 || local green=76
|
local prompt_char='%76F❯%f'
|
||||||
(( left_frame )) || left=('' $left[2] '' "%${green}F❯%f ${buffer:-█}")
|
[[ $style == pure ]] && prompt_char="%F{$pure_color[magenta]}❯%f"
|
||||||
|
[[ $style == lean_8colors ]] && prompt_char='%2F❯%f'
|
||||||
|
(( left_frame )) || left=('' $left[2] '' "$prompt_char ${buffer:-█}")
|
||||||
(( right_frame )) || right=($right[1] '' '' '')
|
(( right_frame )) || right=($right[1] '' '' '')
|
||||||
fi
|
fi
|
||||||
local -i right_indent=prompt_indent
|
local -i right_indent=prompt_indent
|
||||||
|
@ -567,13 +571,14 @@ function ask_style() {
|
||||||
else
|
else
|
||||||
local nl=$'\n'
|
local nl=$'\n'
|
||||||
fi
|
fi
|
||||||
|
(( terminfo[colors] >= 256 )) && local lean=lean || local lean=lean_8colors
|
||||||
while true; do
|
while true; do
|
||||||
clear
|
clear
|
||||||
flowing -c "%BPrompt Style%b"
|
flowing -c "%BPrompt Style%b"
|
||||||
print -n $nl
|
print -n $nl
|
||||||
print -P "%B(1) Lean.%b"
|
print -P "%B(1) Lean.%b"
|
||||||
print -n $nl
|
print -n $nl
|
||||||
style=lean left_frame=0 right_frame=0 print_prompt
|
style=$lean left_frame=0 right_frame=0 print_prompt
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "%B(2) Classic.%b"
|
print -P "%B(2) Classic.%b"
|
||||||
print -n $nl
|
print -n $nl
|
||||||
|
@ -596,47 +601,88 @@ function ask_style() {
|
||||||
case $key in
|
case $key in
|
||||||
q) quit;;
|
q) quit;;
|
||||||
r) return 1;;
|
r) return 1;;
|
||||||
1) style=lean; left_frame=0; right_frame=0; options+=lean; break;;
|
1) style=$lean; left_frame=0; right_frame=0; options+=$lean; break;;
|
||||||
2) style=classic; options+=classic; break;;
|
2) style=classic; options+=classic; break;;
|
||||||
3) style=rainbow; options+=rainbow; break;;
|
3) style=rainbow; options+=rainbow; break;;
|
||||||
4) style=pure; empty_line=1; options+=pure; break;;
|
4) style=pure; empty_line=1; options+=pure; break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
if [[ $style == lean_8colors ]]; then
|
||||||
|
frame_color=(0 7 2 4)
|
||||||
|
color_name=(Black White Green Blue)
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ask_color_scheme() {
|
function ask_color_scheme() {
|
||||||
[[ $style != lean ]] && return
|
if [[ $style == lean ]]; then
|
||||||
while true; do
|
while true; do
|
||||||
clear
|
clear
|
||||||
flowing -c "%BPrompt Colors%b"
|
flowing -c "%BPrompt Colors%b"
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "%B(1) 256 colors.%b"
|
print -P "%B(1) 256 colors.%b"
|
||||||
print -P ""
|
print -P ""
|
||||||
style=lean print_prompt
|
style=lean print_prompt
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "%B(2) 8 colors.%b"
|
print -P "%B(2) 8 colors.%b"
|
||||||
print -P ""
|
print -P ""
|
||||||
style=lean_8colors print_prompt
|
style=lean_8colors print_prompt
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "(r) Restart from the beginning."
|
print -P "(r) Restart from the beginning."
|
||||||
print -P "(q) Quit and do nothing."
|
print -P "(q) Quit and do nothing."
|
||||||
print -P ""
|
print -P ""
|
||||||
|
|
||||||
local key=
|
local key=
|
||||||
read -k key${(%):-"?%BChoice [12rq]: %b"} || quit -c
|
read -k key${(%):-"?%BChoice [12rq]: %b"} || quit -c
|
||||||
case $key in
|
case $key in
|
||||||
q) quit;;
|
q) quit;;
|
||||||
r) return 1;;
|
r) return 1;;
|
||||||
1) style=lean; break;;
|
1) style=lean; break;;
|
||||||
2)
|
2)
|
||||||
style=lean_8colors
|
style=lean_8colors
|
||||||
frame_color=(0 7 2 4)
|
frame_color=(0 7 2 4)
|
||||||
color_name=(Black White Green Blue)
|
color_name=(Black White Green Blue)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
options=(${options:#lean} $style)
|
||||||
|
elif [[ $style == pure && $has_truecolor == 1 ]]; then
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
flowing -c "%BPrompt Colors%b"
|
||||||
|
print -P ""
|
||||||
|
print -P "%B(1) Original.%b"
|
||||||
|
print -P ""
|
||||||
|
pure_color=(${(kv)pure_original}) print_prompt
|
||||||
|
print -P ""
|
||||||
|
print -P "%B(2) Snazzy.%b"
|
||||||
|
print -P ""
|
||||||
|
pure_color=(${(kv)pure_snazzy}) print_prompt
|
||||||
|
print -P ""
|
||||||
|
print -P ""
|
||||||
|
print -P "(r) Restart from the beginning."
|
||||||
|
print -P "(q) Quit and do nothing."
|
||||||
|
print -P ""
|
||||||
|
|
||||||
|
local key=
|
||||||
|
read -k key${(%):-"?%BChoice [12rq]: %b"} || quit -c
|
||||||
|
case $key in
|
||||||
|
q) quit;;
|
||||||
|
r) return 1;;
|
||||||
|
1)
|
||||||
|
pure_color=(${(kv)pure_original})
|
||||||
|
options+=original
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
pure_color=(${(kv)pure_snazzy})
|
||||||
|
options+=snazzy
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ask_color() {
|
function ask_color() {
|
||||||
|
@ -1270,7 +1316,6 @@ function ask_empty_line() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ask_instant_prompt() {
|
function ask_instant_prompt() {
|
||||||
autoload -Uz is-at-least
|
|
||||||
if ! is-at-least 5.4; then
|
if ! is-at-least 5.4; then
|
||||||
instant_prompt=off
|
instant_prompt=off
|
||||||
return 0
|
return 0
|
||||||
|
@ -1316,7 +1361,8 @@ function ask_instant_prompt() {
|
||||||
function ask_transient_prompt() {
|
function ask_transient_prompt() {
|
||||||
local disable_rprompt=$((num_lines == 1))
|
local disable_rprompt=$((num_lines == 1))
|
||||||
local prompt_char='%76F❯%f'
|
local prompt_char='%76F❯%f'
|
||||||
[[ $style == pure ]] && prompt_char='%5F❯%f'
|
[[ $style == pure ]] && prompt_char="%F{$pure_color[magenta]}❯%f"
|
||||||
|
[[ $style == lean_8colors ]] && prompt_char='%2F❯%f'
|
||||||
while true; do
|
while true; do
|
||||||
clear
|
clear
|
||||||
flowing -c "%BEnable Transient Prompt?%b"
|
flowing -c "%BEnable Transient Prompt?%b"
|
||||||
|
@ -1473,7 +1519,15 @@ function generate_config() {
|
||||||
lines=("${(@)lines//$1/$2}")
|
lines=("${(@)lines//$1/$2}")
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $style != pure ]]; then
|
if [[ $style == pure ]]; then
|
||||||
|
rep "local grey=242" "local grey='$pure_color[grey]'"
|
||||||
|
rep "local red=1" "local red='$pure_color[red]'"
|
||||||
|
rep "local yellow=3" "local yellow='$pure_color[yellow]'"
|
||||||
|
rep "local blue=4" "local blue='$pure_color[blue]'"
|
||||||
|
rep "local magenta=5" "local magenta='$pure_color[magenta]'"
|
||||||
|
rep "local cyan=6" "local cyan='$pure_color[cyan]'"
|
||||||
|
rep "local white=7" "local white='$pure_color[white]'"
|
||||||
|
else
|
||||||
sub MODE $POWERLEVEL9K_MODE
|
sub MODE $POWERLEVEL9K_MODE
|
||||||
|
|
||||||
if (( cap_narrow_icons )); then
|
if (( cap_narrow_icons )); then
|
||||||
|
@ -1726,8 +1780,16 @@ else
|
||||||
_p9k_can_configure -q || return
|
_p9k_can_configure -q || return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
zmodload zsh/terminfo || return
|
||||||
|
autoload -Uz is-at-least || return
|
||||||
source $__p9k_root_dir/internal/icons.zsh || return
|
source $__p9k_root_dir/internal/icons.zsh || return
|
||||||
|
|
||||||
|
if is-at-least 5.7.1 && [[ $COLORTERM == (24bit|truecolor) ]]; then
|
||||||
|
local -ir has_truecolor=1
|
||||||
|
else
|
||||||
|
local -ir has_truecolor=0
|
||||||
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
local instant_prompt=verbose zshrc_content= zshrc_backup= zshrc_backup_u=
|
local instant_prompt=verbose zshrc_content= zshrc_backup= zshrc_backup_u=
|
||||||
local -i zshrc_has_cfg=0 zshrc_has_instant_prompt=0 write_zshrc=0
|
local -i zshrc_has_cfg=0 zshrc_has_instant_prompt=0 write_zshrc=0
|
||||||
|
@ -1740,6 +1802,11 @@ while true; do
|
||||||
local -a color_name=(Lightest Light Dark Darkest)
|
local -a color_name=(Lightest Light Dark Darkest)
|
||||||
local -a prefixes=('' '')
|
local -a prefixes=('' '')
|
||||||
local -a options=()
|
local -a options=()
|
||||||
|
if (( has_truecolor )); then
|
||||||
|
local -A pure_color=(${(kv)pure_snazzy})
|
||||||
|
else
|
||||||
|
local -A pure_color=(${(kv)pure_original})
|
||||||
|
fi
|
||||||
|
|
||||||
ask_font || continue
|
ask_font || continue
|
||||||
ask_diamond || continue
|
ask_diamond || continue
|
||||||
|
@ -1797,8 +1864,8 @@ while true; do
|
||||||
_p9k_init_icons
|
_p9k_init_icons
|
||||||
ask_narrow_icons || continue
|
ask_narrow_icons || continue
|
||||||
ask_style || continue
|
ask_style || continue
|
||||||
|
ask_color_scheme || continue
|
||||||
if [[ $style != pure ]]; then
|
if [[ $style != pure ]]; then
|
||||||
ask_color_scheme || continue
|
|
||||||
ask_color || continue
|
ask_color || continue
|
||||||
ask_time || continue
|
ask_time || continue
|
||||||
ask_separators || continue
|
ask_separators || continue
|
||||||
|
|
Loading…
Reference in a new issue