zshuper/functions/rationalise-dot.zsh

15 lines
329 B
Bash
Raw Normal View History

2016-06-19 04:11:34 +03:00
# Alias '...' to do '../..'
# Example: type 'cd ...' to get 'cd ../..'
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