1
0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-12 19:18:28 +02:00

new segment: per_directory_history (#2384)

This commit is contained in:
Roman Perepelitsa 2023-07-25 13:25:19 +02:00
parent 1d96f5e066
commit 7e9a79f3f1
6 changed files with 91 additions and 1 deletions

View File

@ -97,6 +97,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
per_directory_history # Oh My Zsh per-directory-history local/global indicator
# cpu_arch # CPU architecture
# time # current time
# =========================[ Line #2 ]=========================
@ -887,6 +888,19 @@
# Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐'
######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]#######
# Color when using local/global history.
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=135
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=130
# Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION=''
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_CONTENT_EXPANSION=''
# Custom icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ cpu_arch: CPU architecture ]################################
# CPU architecture color.
typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172

View File

@ -96,6 +96,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
per_directory_history # Oh My Zsh per-directory-history local/global indicator
# cpu_arch # CPU architecture
# time # current time
# =========================[ Line #2 ]=========================
@ -865,6 +866,19 @@
# Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐'
######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]#######
# Color when using local/global history.
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=5
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=3
# Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION=''
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_CONTENT_EXPANSION=''
# Custom icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ cpu_arch: CPU architecture ]################################
# CPU architecture color.
typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=3

View File

@ -96,6 +96,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
per_directory_history # Oh My Zsh per-directory-history local/global indicator
# cpu_arch # CPU architecture
# time # current time
# =========================[ Line #2 ]=========================
@ -861,6 +862,19 @@
# Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐'
######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]#######
# Color when using local/global history.
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=135
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=130
# Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION=''
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_CONTENT_EXPANSION=''
# Custom icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ cpu_arch: CPU architecture ]################################
# CPU architecture color.
typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=172

View File

@ -97,6 +97,7 @@
todo # todo items (https://github.com/todotxt/todo.txt-cli)
timewarrior # timewarrior tracking status (https://timewarrior.net/)
taskwarrior # taskwarrior task count (https://taskwarrior.org/)
per_directory_history # Oh My Zsh per-directory-history local/global indicator
# cpu_arch # CPU architecture
# time # current time
# =========================[ Line #2 ]=========================
@ -924,6 +925,21 @@
# Custom icon.
# typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐'
######[ per_directory_history: Oh My Zsh per-directory-history local/global indicator ]#######
# Color when using local/global history.
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_FOREGROUND=0
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_BACKGROUND=5
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_FOREGROUND=0
typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_BACKGROUND=3
# Tip: Uncomment the next two lines to hide "local"/"global" text and leave just the icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_CONTENT_EXPANSION=''
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_CONTENT_EXPANSION=''
# Custom icon.
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_LOCAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_PER_DIRECTORY_HISTORY_GLOBAL_VISUAL_IDENTIFIER_EXPANSION='⭐'
################################[ cpu_arch: CPU architecture ]################################
# CPU architecture color.
typeset -g POWERLEVEL9K_CPU_ARCH_FOREGROUND=0

View File

@ -153,6 +153,7 @@ function _p9k_init_icons() {
SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON 'arch'
HISTORY_ICON 'hist'
)
;;
'awesome-fontconfig')
@ -290,6 +291,7 @@ function _p9k_init_icons() {
SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON 'arch'
HISTORY_ICON 'hist'
)
;;
'awesome-mapped-fontconfig')
@ -430,6 +432,7 @@ function _p9k_init_icons() {
SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON 'arch'
HISTORY_ICON 'hist'
)
;;
'nerdfont-v3')
@ -568,6 +571,7 @@ function _p9k_init_icons() {
SCALA_ICON '\uE737' # 
TOOLBOX_ICON '\uE20F'$s # 
ARCH_ICON '\uE266' # 
HISTORY_ICON '\uF1DA'$s # 
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
@ -706,6 +710,7 @@ function _p9k_init_icons() {
SCALA_ICON '\uE737' # 
TOOLBOX_ICON '\uE20F'$s # 
ARCH_ICON '\uE266' # 
HISTORY_ICON '\uF1DA'$s # 
)
;;
ascii)
@ -841,6 +846,7 @@ function _p9k_init_icons() {
SCALA_ICON 'scala'
TOOLBOX_ICON 'toolbox'
ARCH_ICON 'arch'
HISTORY_ICON 'hist'
)
;;
*)
@ -978,6 +984,7 @@ function _p9k_init_icons() {
SCALA_ICON 'scala'
TOOLBOX_ICON '\u2B22' # ⬢
ARCH_ICON 'arch'
HISTORY_ICON 'hist'
)
;;
esac

View File

@ -5731,6 +5731,31 @@ _p9k_prompt_cpu_arch_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[machine]$commands[arch]'
}
################################################################
# Oh My Zsh per-directory-history local/global indicator
prompt_per_directory_history() {
if [[ $_per_directory_history_is_global == true ]]; then
_p9k_prompt_segment ${0}_GLOBAL 3 $_p9k_color1 HISTORY_ICON 0 '' global
else
_p9k_prompt_segment ${0}_LOCAL 5 $_p9k_color1 HISTORY_ICON 0 '' local
fi
}
instant_prompt_per_directory_history() {
case $HISTORY_START_WITH_GLOBAL in
true)
_p9k_prompt_segment prompt_per_directory_history_GLOBAL 3 $_p9k_color1 HISTORY_ICON 0 '' global
;;
?*)
_p9k_prompt_segment prompt_per_directory_history_LOCAL 5 $_p9k_color1 HISTORY_ICON 0 '' local
;;
esac
}
_p9k_prompt_per_directory_history_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$PER_DIRECTORY_HISTORY_TOGGLE'
}
# 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() {
@ -9375,7 +9400,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
fi
typeset -g P9K_VERSION=1.19.4
typeset -g P9K_VERSION=1.19.5
unset VSCODE_SHELL_INTEGRATION
_p9k_init_ssh