zshuper/modules/rationalize-dot.zsh

19 lines
342 B
Bash
Raw Normal View History

2018-02-03 02:29:33 +02:00
#
2016-06-19 04:11:34 +03:00
# Alias '...' to do '../..'
# Example: type 'cd ...' to get 'cd ../..'
2018-02-03 02:29:33 +02:00
#
function rationalise-dot {
2016-06-19 04:11:34 +03:00
local MATCH
if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then
LBUFFER+=/
zle self-insert
zle self-insert
else
zle self-insert
fi
}
2018-02-03 02:29:33 +02:00
2016-06-19 04:11:34 +03:00
zle -N rationalise-dot
bindkey . rationalise-dot