dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 6a6f6fc5ea89431ebe546f351062d80e06b4b126
parent 6093a84a4fe78006b52b5c1c52a4d7b46854dff6
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sat, 25 Apr 2020 23:36:16 +0200

zsh: shell level indicator in p10k

Former-commit-id: 88b4c48af678d5ed91b0777c04b19f87d2ce3cff
Diffstat:
Mshell/p10k-dark.zsh | 16++++++++++++++++
Mshell/p10k-light.zsh | 16++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/shell/p10k-dark.zsh b/shell/p10k-dark.zsh @@ -39,6 +39,7 @@ # os_icon # os identifier dir # current directory vcs # git status + nest_level # prompt_char # prompt symbol ) @@ -1133,6 +1134,21 @@ p10k segment -f 208 -i '⭐' -t 'hello, %n' } + # shell nest level + function prompt_nest_level() { + # _my_lvl := $TMUX == "" ? $SHLVL : $((SHLVL-1)) + # local lvl='${${_my_lvl::=${${TMUX:+$((SHLVL-1))}:-$SHLVL}}+}' + # p10k segment -f 4 -e -t $lvl'%B${(l:$_my_lvl::$_my_lvl:)}%(1j.%j.)' + # These ^ are cool functions but overkill for me + local lvl=$(if [ $SHLVL -gt 1 ]; then printf "(L$SHLVL)"; else printf ""; fi) + p10k segment -f 4 -t "$lvl" + } + + # shell nest level instant placeholder + function instant_prompt_nest_level() { + prompt_nest_level + } + # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job # is to generate the prompt segment for display in instant prompt. See # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. diff --git a/shell/p10k-light.zsh b/shell/p10k-light.zsh @@ -38,6 +38,7 @@ # os_icon # os identifier dir # current directory vcs # git status + nest_level prompt_char # prompt symbol ) @@ -1269,6 +1270,21 @@ p10k segment -f 2 -i '⭐' -t 'hello, %n' } + # shell nest level + function prompt_nest_level() { + # _my_lvl := $TMUX == "" ? $SHLVL : $((SHLVL-1)) + # local lvl='${${_my_lvl::=${${TMUX:+$((SHLVL-1))}:-$SHLVL}}+}' + # p10k segment -f 4 -e -t $lvl'%B${(l:$_my_lvl::$_my_lvl:)}%(1j.%j.)' + # These ^ are cool functions but overkill for me + local lvl=$(if [ $SHLVL -gt 1 ]; then printf "(L$SHLVL)"; else printf ""; fi) + p10k segment -f 4 -t "$lvl" + } + + # shell nest level instant placeholder + function instant_prompt_nest_level() { + prompt_nest_level + } + # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job # is to generate the prompt segment for display in instant prompt. See # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.