zshuper/modules/rationalize-dot.zsh
2018-02-03 02:29:33 +02:00

19 lines
342 B
Bash

#
# Alias '...' to do '../..'
# Example: type 'cd ...' to get 'cd ../..'
#
function rationalise-dot {
local MATCH
if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then
LBUFFER+=/
zle self-insert
zle self-insert
else
zle self-insert
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot