From 0caabf18f5a28200947c1ec0d556758f8174189f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Uruba?= Date: Mon, 28 Dec 2020 13:56:41 +0100 Subject: [PATCH] display shell level --- zsh/.zshrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 37e7079..f98a0c6 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -20,7 +20,7 @@ export PATH autoload -U colors colors PROMPT="%{$fg_bold[yellow]%}%* %{$fg_bold[cyan]%}%d %(?.$fg_bold[green]✓.$fg_bold[red]%?) -%{$fg_bold[yellow]%}%% %{$reset_color%}" +%(3L.$fg_bold[red]%L .)%{$fg_bold[yellow]%}%% %{$reset_color%}" source $HOME/.config/zsh/key-bindings.zsh @@ -29,11 +29,15 @@ bindkey "^[[4~" end-of-line bindkey "^[[4h" overwrite-mode bindkey "^[[P" delete-char -# save path on cd (chpwd is a zsh hook) +# save path on cd (chpwd is a zsh hook) and spawned subshell function chpwd { pwd > ~/.last_dir } +if [[ $SHLVL -ge 3 ]]; then + chpwd +fi + # restore last saved path on launch if [[ -f ~/.last_dir ]]; then cd $(cat ~/.last_dir)