All shells understand these commands:
$ cd .
$ cd ..
And zsh will also understand:
$ cd ...
$ cd ....
Provide
What I did to to deal with the same problem is to just let zsh fill in ../..
when I type ...
and it makes sense to expand it in that way. It may suit you (or not :-P):
if is-at-least 5.0.0 && [[ ! $UID -eq 0 ]]; then
## http://www.zsh.org/mla/users/2010/msg00769.html
function rationalise-dot() {
local MATCH # keep the regex match from leaking to the environment
if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' && ! $LBUFFER = p4* ]]; then
#if [[ ! $LBUFFER = p4* && $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
zle self-insert
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot
bindkey -M isearch . self-insert
fi
I also have an alias for ...
, but it is not global.
Notice I check if the command line starts with p4
(the Perforce command line tool) and do not mess with it in that case, as Perforce arguments often involve literal ...
. If you do not use p4
you can obviously remove that check.