diff options
author | Alexis Hovorka <[email protected]> | 2021-07-04 19:44:28 -0600 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2021-07-04 19:44:28 -0600 |
commit | b5a3ecb81eadda4c48a97dd8099b07bb453219f1 (patch) | |
tree | 21673eb2a3d664fb27c05d3ff12a31ffc80eb1af /base | |
parent | 20bb7b80d9decc521d6a0e3948d0d21cbf8c2553 (diff) |
[feat] Add zsh .... path expansion
Diffstat (limited to 'base')
-rw-r--r-- | base/zsh/fancy-dots.zsh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/base/zsh/fancy-dots.zsh b/base/zsh/fancy-dots.zsh new file mode 100644 index 0000000..def0e22 --- /dev/null +++ b/base/zsh/fancy-dots.zsh @@ -0,0 +1,24 @@ +# Based on http://stackoverflow.com/a/41420448/4757 + +function expand-multiple-dots() { + local MATCH + if [[ $LBUFFER =~ '(^| )\.\.\.+' ]]; then + LBUFFER=$LBUFFER:fs%\.\.\.%../..% + fi +} + +function expand-multiple-dots-then-expand-or-complete() { + zle expand-multiple-dots + zle expand-or-complete +} + +function expand-multiple-dots-then-accept-line() { + zle expand-multiple-dots + zle accept-line +} + +zle -N expand-multiple-dots +zle -N expand-multiple-dots-then-expand-or-complete +zle -N expand-multiple-dots-then-accept-line +bindkey '^I' expand-multiple-dots-then-expand-or-complete +bindkey '^M' expand-multiple-dots-then-accept-line |