mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Add plugin to save the present working directory over different zsh sessions. The last change in directory will be preserved. Add `chpwd' function to change the directory new shells will be opened in.
10 lines
248 B
Bash
10 lines
248 B
Bash
DIRSTACKSIZE=9
|
|
DIRSTACKFILE=~/.zdirs
|
|
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
|
|
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
|
|
[[ -d $dirstack[1] ]] && cd $dirstack[1]
|
|
fi
|
|
|
|
function chpwd() {
|
|
print -l $PWD ${(u)dirstack}> $DIRSTACKFILE
|
|
}
|