From e4349e0c9b6aff27d25afadbf0717b21baa9e6bc Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Thu, 23 Jan 2020 11:49:19 +0100
Subject: fix option names in the color selection screen; fixes #432

---
 internal/wizard.zsh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 5d44868b..d0077c73 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -700,15 +700,15 @@ function ask_color() {
     print -n $nl
     color=1 print_prompt
     print -P ""
-    print -P "%B(1)  $color_name[2].%b"
+    print -P "%B(2)  $color_name[2].%b"
     print -n $nl
     color=2 print_prompt
     print -P ""
-    print -P "%B(1)  $color_name[3].%b"
+    print -P "%B(3)  $color_name[3].%b"
     print -n $nl
     color=3 print_prompt
     print -P ""
-    print -P "%B(1)  $color_name[4].%b"
+    print -P "%B(4)  $color_name[4].%b"
     print -n $nl
     color=4 print_prompt
     print -P ""
-- 
cgit v1.2.3


From 186d1539b931c58b60a7fdfaadffb7cde5f57403 Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Thu, 23 Jan 2020 15:25:13 +0100
Subject: add POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER; see #430

---
 internal/p10k.zsh | 44 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 0b7bf831..3e605700 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1473,7 +1473,12 @@ prompt_dir() {
       shortenlen=${_POWERLEVEL9K_SHORTEN_DIR_LENGTH:-1}
       (( shortenlen >= 0 )) || shortenlen=1
       local -i i=2 e=$(($#parts - shortenlen))
-      [[ $p[1] == / ]] && (( ++i ))
+      if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
+        (( e += shortenlen ))
+        local orig=("$parts[2]" "${(@)parts[$((shortenlen > $#parts ? -$#parts : -shortenlen)),-1]}")
+      elif [[ $p[1] == / ]]; then
+        (( ++i ))
+      fi
       local parent="${_p9k_pwd%/${(pj./.)parts[i,-1]}}"
       if (( i <= e )); then
         local MATCH= mtimes=()
@@ -1524,11 +1529,34 @@ prompt_dir() {
           fi
           parent+=/$sub
         done
-        for ((; i <= $#parts; ++i)); do
-          [[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
-          parts[i]+=$'\2'
-        done
-        [[ -n $key ]] && _p9k_cache_ephemeral_set "$key" "${parts[@]}"
+        if (( _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER )); then
+          local _2=$'\2'
+          (( e = ${parts[(I)*$_2]} ))
+          if (( e > 1 )); then
+            parts[1,e-1]=()
+            fake_first=1
+          elif [[ $p == /?* ]]; then
+            parts[2]="\${(Q)\${:-${(qqq)${(q)orig[1]}}}}"$'\2'
+          fi
+          for ((i = $#parts < shortenlen ? $#parts : shortenlen; i > 0; --i)); do
+            [[ $#parts[-i] == *$'\2' ]] && continue
+            if [[ $orig[-i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]]; then
+              parts[-i]='${(Q)${:-'${(qqq)${(q)orig[-i]}}'}}'$'\2'
+            else
+              parts[-i]=${orig[-i]}$'\2'
+            fi
+          done
+        else
+          for ((; i <= $#parts; ++i)); do
+            [[ $parts[i] == *["~!#\`\$^&*()\\\"'<>?{}[]"]* ]] && parts[i]='${(Q)${:-'${(qqq)${(q)parts[i]}}'}}'
+            parts[i]+=$'\2'
+          done
+        fi
+        if [[ -n $key ]]; then
+          _p9k_cache_ephemeral_set "$key" "${parts[@]}"
+        else
+          _p9k_cache_val=("$key" "${parts[@]}")
+        fi
       fi
       parts=("${(@)_p9k_cache_val[2,-1]}")
     ;;
@@ -5200,6 +5228,8 @@ _p9k_init_params() {
   _p9k_declare -a POWERLEVEL9K_DIR_CLASSES
   _p9k_declare -i POWERLEVEL9K_SHORTEN_DELIMITER_LENGTH
   _p9k_declare -e POWERLEVEL9K_SHORTEN_DELIMITER
+  _p9k_declare -b POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER
+  [[ -z $_POWERLEVEL9K_SHORTEN_FOLDER_MARKER ]] && _POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=0
   _p9k_declare -i POWERLEVEL9K_SHORTEN_DIR_LENGTH
   _p9k_declare -s POWERLEVEL9K_IP_INTERFACE ""
   _p9k_declare -s POWERLEVEL9K_VPN_IP_INTERFACE "(wg|(.*tun))[0-9]*"
@@ -6241,7 +6271,7 @@ _p9k_must_init() {
     [[ $sig == $_p9k__param_sig ]] && return 1
     _p9k_deinit
   fi
-  _p9k__param_pat=$'v26\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
+  _p9k__param_pat=$'v27\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
   _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
   _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
   _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
-- 
cgit v1.2.3


From 08f73b27fd07cf841e02cc4182c0df042905c420 Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Fri, 24 Jan 2020 18:41:17 +0100
Subject: cherry pick disk_usage fix from
 https://github.com/romkatv/powerlevel10k/commit/0d33157b1232123bda62d86be6313f1012cc3bd7;
 see #435

---
 internal/p10k.zsh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 3e605700..2fe7fb50 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -1033,16 +1033,16 @@ prompt_disk_usage() {
   local disk_usage=${${=${(f)"$(df -P . 2>/dev/null)"}[2]}[5]%%%}
   local state bg fg
   if (( disk_usage >= _POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL )); then
-    state=critical
+    state=CRITICAL
     bg=red
     fg=white
   elif (( disk_usage >= _POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL )); then
-    state=warning
+    state=WARNING
     bg=yellow
     fg=$_p9k_color1
   else
     (( _POWERLEVEL9K_DISK_USAGE_ONLY_WARNING )) && return
-    state=normal
+    state=NORMAL
     bg=$_p9k_color1
     fg=yellow
   fi
-- 
cgit v1.2.3


From 1fb30a62e7db5fe5a2242932798984024deddb05 Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Sat, 18 Jan 2020 17:09:15 +0100
Subject: add disk_usage to config templates

---
 config/p10k-classic.zsh      | 14 ++++++++++++++
 config/p10k-lean-8colors.zsh | 14 ++++++++++++++
 config/p10k-lean.zsh         | 14 ++++++++++++++
 config/p10k-rainbow.zsh      | 17 +++++++++++++++++
 4 files changed, 59 insertions(+)

diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh
index 5886dfe3..09dfbf78 100644
--- a/config/p10k-classic.zsh
+++ b/config/p10k-classic.zsh
@@ -80,6 +80,7 @@
     midnight_commander      # midnight commander shell (https://midnight-commander.org/)
     vi_mode                 # vi mode (you don't need this if you've enabled prompt_char)
     # vpn_ip                # virtual private network indicator
+    # disk_usage            # disk usage
     # ram                   # free RAM
     # load                  # CPU load
     todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
@@ -547,6 +548,19 @@
   # Icon to show when in a midnight commander shell.
   typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
 
+  ##################################[ disk_usgae: disk usage ]##################################
+  # Colors for different levels of disk usage.
+  typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160
+  # Thresholds for different levels of disk usage (percentage points).
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
+  # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent.
+  typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
+  # Custom icon.
+  # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
   ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]###########
   # Text and color for normal (a.k.a. command) vi mode.
   typeset -g POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh
index 55ee28b4..2f972502 100644
--- a/config/p10k-lean-8colors.zsh
+++ b/config/p10k-lean-8colors.zsh
@@ -79,6 +79,7 @@
     vim_shell               # vim shell indicator (:sh)
     midnight_commander      # midnight commander shell (https://midnight-commander.org/)
     # vpn_ip                # virtual private network indicator
+    # disk_usage            # disk usage
     # ram                   # free RAM
     # load                  # CPU load
     todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
@@ -543,6 +544,19 @@
   # Icon to show when in a midnight commander shell.
   typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
 
+  ##################################[ disk_usgae: disk usage ]##################################
+  # Colors for different levels of disk usage.
+  typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=2
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=3
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=1
+  # Thresholds for different levels of disk usage (percentage points).
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
+  # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent.
+  typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
+  # Custom icon.
+  # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
   ######################################[ ram: free RAM ]#######################################
   # RAM color.
   typeset -g POWERLEVEL9K_RAM_FOREGROUND=2
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh
index 22da5a05..c4525566 100644
--- a/config/p10k-lean.zsh
+++ b/config/p10k-lean.zsh
@@ -79,6 +79,7 @@
     vim_shell               # vim shell indicator (:sh)
     midnight_commander      # midnight commander shell (https://midnight-commander.org/)
     # vpn_ip                # virtual private network indicator
+    # disk_usage            # disk usage
     # ram                   # free RAM
     # load                  # CPU load
     todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
@@ -543,6 +544,19 @@
   # Icon to show when in a midnight commander shell.
   typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
 
+  ##################################[ disk_usgae: disk usage ]##################################
+  # Colors for different levels of disk usage.
+  typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160
+  # Thresholds for different levels of disk usage (percentage points).
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
+  # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent.
+  typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
+  # Custom icon.
+  # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
   ######################################[ ram: free RAM ]#######################################
   # RAM color.
   typeset -g POWERLEVEL9K_RAM_FOREGROUND=66
diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh
index 3cfeb8a1..6d68dde0 100644
--- a/config/p10k-rainbow.zsh
+++ b/config/p10k-rainbow.zsh
@@ -80,6 +80,7 @@
     midnight_commander      # midnight commander shell (https://midnight-commander.org/)
     vi_mode                 # vi mode (you don't need this if you've enabled prompt_char)
     # vpn_ip                # virtual private network indicator
+    # disk_usage            # disk usage
     # ram                   # free RAM
     # load                  # CPU load
     todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
@@ -549,6 +550,22 @@
   # Icon to show when in a midnight commander shell.
   typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
 
+  ##################################[ disk_usgae: disk usage ]##################################
+  # Colors for different levels of disk usage.
+  # typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=3
+  # typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=0
+  # typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=0
+  # typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=3
+  # typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=7
+  # typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=1
+  # Thresholds for different levels of disk usage (percentage points).
+  typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
+  typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
+  # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent.
+  typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
+  # Custom icon.
+  # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
   ###########[ vi_mode: vi mode (you don't need this if you've enabled prompt_char) ]###########
   # Foreground color.
   typeset -g POWERLEVEL9K_VI_MODE_FOREGROUND=0
-- 
cgit v1.2.3


From 833cc73f73dc46744b21683f92d4ac55eb9c369b Mon Sep 17 00:00:00 2001
From: romkatv <roman.perepelitsa@gmail.com>
Date: Fri, 24 Jan 2020 18:50:22 +0100
Subject: add a link to gitter

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 9f877f78..2d100914 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
 # Powerlevel10k
+[![Gitter](https://badges.gitter.im/powerlevel10k/community.svg)](https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
 
 Powerlevel10k is a theme for ZSH. It's fast, flexible and easy to install and configure.
 
-- 
cgit v1.2.3