aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2023-07-25 14:25:19 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2023-07-25 14:25:19 +0300
commit7e9a79f3f1ffefadde83630f9beb6e9708d26b42 (patch)
treeeb46aae5fc027d86ce82875060033ca8da4fb636
parent1d96f5e066a5dd569ddd24787d7e9a3c3abe3024 (diff)
new segment: per_directory_history (#2384)
-rw-r--r--config/p10k-classic.zsh14
-rw-r--r--config/p10k-lean-8colors.zsh14
-rw-r--r--config/p10k-lean.zsh14
-rw-r--r--config/p10k-rainbow.zsh16
-rw-r--r--internal/icons.zsh7
-rw-r--r--internal/p10k.zsh27
6 files changed, 91 insertions, 1 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 14ebd38c..aacb22d4 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -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
diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh
index 917fe714..9d1d3003 100644
--- a/config/p10k-lean-8colors.zsh
+++ b/config/p10k-lean-8colors.zsh
@@ -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
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index 97c7e288..1581c170 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -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
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index 53606ff2..3fe2dfaf 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -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
diff --git a/internal/icons.zsh b/internal/icons.zsh
index 4fce1ee0..3172ed2f 100644
--- a/internal/icons.zsh
+++ b/internal/icons.zsh
@@ -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
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 33b36df4..97c14710 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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