Commit 6f63ee5f5fbf
Changed files (1)
dots
config
boox
dots/config/boox/zshrc
@@ -1,7 +1,41 @@
# Boox (osaka) Termux zsh config โ lightweight for e-ink
-# Prompt โ simple, no fancy unicode/colors (e-ink friendly)
-PROMPT='%~ %# '
+# Prompt โ matching homelab style, simplified for e-ink
+_shorten_path() {
+ local p="$1" max="${2:-50}"
+ (( ${#p} <= max )) && { echo "$p"; return; }
+ local parts=("${(@s:/:)p}")
+ local len=${#parts[@]}
+ local i
+ for (( i=1; i <= len - 2; i++ )); do
+ (( ${#p} <= max )) && break
+ (( ${#parts[$i]} <= 2 )) && continue
+ if [[ "${parts[$i]}" == .* ]]; then
+ parts[$i]=".${parts[$i]:1:1}"
+ else
+ parts[$i]="${parts[$i]:0:1}"
+ fi
+ p="${(j:/:)parts}"
+ done
+ echo "$p"
+}
+
+_prompt_dir() {
+ local dir="${PWD/#$HOME/~}"
+ if (( ${#dir} > 50 )); then
+ dir=$(_shorten_path "$dir" 50)
+ fi
+ echo "$dir"
+}
+
+_prompt_git_branch() {
+ local branch
+ branch=$(git symbolic-ref --short HEAD 2>/dev/null)
+ [[ -n $branch ]] && echo " $branch"
+}
+
+setopt PROMPT_SUBST
+export PROMPT='%m:$(_prompt_dir)$(_prompt_git_branch) %(!.#.$) '
# History
HISTFILE=~/.zsh_history