zsh: Improve chpwd behaviour
This commit is contained in:
parent
4b2ddd8fcc
commit
285343d6ef
10
zsh/.zshrc
10
zsh/.zshrc
@ -94,12 +94,12 @@ bindkey "^K" kill-line # Ctrl + k
|
|||||||
bindkey "^U" backward-kill-line # Ctrl + u
|
bindkey "^U" backward-kill-line # Ctrl + u
|
||||||
|
|
||||||
# save path on cd (chpwd is a zsh hook) and spawned subshell
|
# 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
|
if [[ $SHLVL -gt 3 ]]; then
|
||||||
chpwd
|
_chpwd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restore last saved path on launch
|
# restore last saved path on launch
|
||||||
@ -107,6 +107,10 @@ if [[ -f ~/.last_dir ]]; then
|
|||||||
cd $(cat ~/.last_dir)
|
cd $(cat ~/.last_dir)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function chpwd {
|
||||||
|
_chpwd
|
||||||
|
}
|
||||||
|
|
||||||
# save path on quiting nnn (and alias it to 'n')
|
# save path on quiting nnn (and alias it to 'n')
|
||||||
function n {
|
function n {
|
||||||
# Block nesting of nnn in subshells
|
# Block nesting of nnn in subshells
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user