Created
November 10, 2023 06:09
-
-
Save daodao97/52a37dd5667e5c254ea15d54c417a514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function expand-dots() { | |
local MATCH | |
if [[ $LBUFFER =~ '^\.\.\.+$' ]]; then | |
LBUFFER=$LBUFFER:fs%\.\.\.%../..% | |
LBUFFER="cd $LBUFFER" | |
fi | |
} | |
function expand-dots-then-expand-or-complete() { | |
zle expand-dots | |
zle expand-or-complete | |
} | |
function expand-dots-then-accept-line() { | |
zle expand-dots | |
zle accept-line | |
} | |
zle -N expand-dots | |
zle -N expand-dots-then-expand-or-complete | |
zle -N expand-dots-then-accept-line | |
bindkey '^I' expand-dots-then-expand-or-complete | |
bindkey '^M' expand-dots-then-accept-line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment