Shell: fixed Zsh dirstack handling spaces, finally!
parent
d47d37b221
commit
0bb8725e5e
|
@ -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
|
||||
}
|
||||
|
||||
##==============================================================================
|
||||
## ???
|
||||
##==============================================================================
|
||||
|
|
Loading…
Reference in New Issue