|
@@ -9,31 +9,36 @@
|
|
|
# pushd -N: start counting from right of `dirs' output
|
|
|
|
|
|
switch-to-dir () {
|
|
|
- [[ ${#dirstack} -eq 0 ]] && return
|
|
|
+ setopt localoptions nopushdminus
|
|
|
+ [[ ${#dirstack} -eq 0 ]] && return 1
|
|
|
|
|
|
while ! builtin pushd -q $1 &>/dev/null; do
|
|
|
# We found a missing directory: pop it out of the dir stack
|
|
|
builtin popd -q $1
|
|
|
|
|
|
# Stop trying if there are no more directories in the dir stack
|
|
|
- [[ ${#dirstack} -eq 0 ]] && break
|
|
|
+ [[ ${#dirstack} -eq 0 ]] && return 1
|
|
|
done
|
|
|
}
|
|
|
|
|
|
insert-cycledleft () {
|
|
|
- emulate -L zsh
|
|
|
- setopt nopushdminus
|
|
|
+ switch-to-dir +1 || return
|
|
|
|
|
|
- switch-to-dir +1
|
|
|
+ local fn
|
|
|
+ for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
|
|
+ (( $+functions[$fn] )) && $fn
|
|
|
+ done
|
|
|
zle reset-prompt
|
|
|
}
|
|
|
zle -N insert-cycledleft
|
|
|
|
|
|
insert-cycledright () {
|
|
|
- emulate -L zsh
|
|
|
- setopt nopushdminus
|
|
|
+ switch-to-dir -0 || return
|
|
|
|
|
|
- switch-to-dir -0
|
|
|
+ local fn
|
|
|
+ for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
|
|
+ (( $+functions[$fn] )) && $fn
|
|
|
+ done
|
|
|
zle reset-prompt
|
|
|
}
|
|
|
zle -N insert-cycledright
|