From 9791b73f51348c8b3dd4a5659ccc6e31af845ab2 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 7 Sep 2023 10:51:27 +0200 Subject: [PATCH] zsh move with dots --- .zshrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.zshrc b/.zshrc index 36c3d8b..8dd0b70 100644 --- a/.zshrc +++ b/.zshrc @@ -74,6 +74,30 @@ bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word bindkey -s "^X" 'n^M' +### ---- EXPAND DOTS ------------------------------------- +function expand-dots() { + local MATCH + if [[ $LBUFFER =~ '(^| )\.\.\.+' ]]; then + LBUFFER=$LBUFFER:fs%\.\.\.%../..% + 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 + ### ---- THEMES ----------------------------------- PS1='%B%F{red}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k'