display shell level

This commit is contained in:
Václav Uruba 2020-12-28 13:56:41 +01:00
parent 512e3d264d
commit 0caabf18f5
Signed by: uruba
GPG Key ID: 0059B34D61727BB0

View File

@ -20,7 +20,7 @@ export PATH
autoload -U colors autoload -U colors
colors colors
PROMPT="%{$fg_bold[yellow]%}%* %{$fg_bold[cyan]%}%d %(?.$fg_bold[green]✓.$fg_bold[red]%?) 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 source $HOME/.config/zsh/key-bindings.zsh
@ -29,11 +29,15 @@ bindkey "^[[4~" end-of-line
bindkey "^[[4h" overwrite-mode bindkey "^[[4h" overwrite-mode
bindkey "^[[P" delete-char 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 { function chpwd {
pwd > ~/.last_dir pwd > ~/.last_dir
} }
if [[ $SHLVL -ge 3 ]]; then
chpwd
fi
# restore last saved path on launch # restore last saved path on launch
if [[ -f ~/.last_dir ]]; then if [[ -f ~/.last_dir ]]; then
cd $(cat ~/.last_dir) cd $(cat ~/.last_dir)