Shell: fixed Zsh dirstack handling spaces, finally!

master
Pierre Neidhardt 2013-05-06 10:42:40 +02:00
parent d47d37b221
commit 0bb8725e5e
1 changed files with 11 additions and 14 deletions

View File

@ -38,27 +38,24 @@ unsetopt beep
##==============================================================================
## Directory stack
##==============================================================================
## TODO: really 20 elements ?
## TODO: handle space in folders.
## TODO: binding for previous/next.
DIRSTACKFILE=~/.zdirs
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
[[ -d $dirstack[1] ]] && cd $dirstack[1]
fi
chpwd() {
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
}
DIRSTACKSIZE=20
setopt autopushd pushdsilent pushdtohome
setopt pushdignoredups
## This revert the +/- operators.
## This reverts the +/- operators.
setopt pushdminus
# alias dh='dirs -v'
if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then
dirstack=( $(< ~/.zdirs) )
popd > /dev/null
fi
precmd() {
dirs -l >! ~/.zdirs
}
##==============================================================================
## ???
##==============================================================================