diff options
| author | Thomas Schneider <qsx@chaotikum.eu> | 2026-07-27 18:58:29 +0200 |
|---|---|---|
| committer | Thomas Schneider <qsx@chaotikum.eu> | 2026-07-27 20:02:38 +0200 |
| commit | 15173a61bcf7c2818df5cef73c98cabd98828753 (patch) | |
| tree | c0e2acbbe77265484e418612aa0519505aa75ac9 /dot.zshrc.local | |
| parent | 5ed62e556d191f83cdb7acbfe822a6dadb9ff221 (diff) | |
zsh: Add shlvl to prompt
Diffstat (limited to 'dot.zshrc.local')
| -rw-r--r-- | dot.zshrc.local | 15 |
1 files changed, 12 insertions, 3 deletions
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 |
