From 15173a61bcf7c2818df5cef73c98cabd98828753 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Mon, 27 Jul 2026 18:58:29 +0200 Subject: zsh: Add shlvl to prompt --- dot.zshrc.local | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'dot.zshrc.local') diff --git a/dot.zshrc.local b/dot.zshrc.local index f48bf28..0772438 100644 --- a/dot.zshrc.local +++ b/dot.zshrc.local @@ -3,7 +3,14 @@ . ~/.zshrc.from_grml zstyle :prompt:grml:right:setup use-rprompt false -zstyle :prompt:grml:left:items:percent pre $'\n' +zstyle :prompt:grml:left:items:shlvl pre $'\n' + +function qsx_prompt_shlvl() { + if (( SHLVL > 1 )); then + REPLY="%F{green}(${SHLVL})%f " + fi +} +grml_theme_add_token shlvl -i qsx_prompt_shlvl # With upstream grml config, both path and vcs components of the prompt tokens # always contain a trailing space, so that 'path vcs percent' is separated by @@ -30,15 +37,17 @@ function qsx_theme_path() { grml_theme_add_token path-qsx -f qsx_theme_path '%B' '%b' local -a items if zstyle -a :prompt:grml:left:setup items items; then + items[-1]="shlvl" + items+=("percent") # find index of "path" local i=${items[(i)path]} # if it exists … if (( ${+items[$i]} )); then # … replace with our version … items[$i]="path-qsx" - # … and apply - zstyle :prompt:grml:left:setup items ${items} fi + # … and apply + zstyle :prompt:grml:left:setup items ${items} unset i fi unset items -- cgit v1.2.3