From 8792518bcb87ae659b3bb5eb8bf15b83be88acaa Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 22 Sep 2022 15:09:39 +0200 Subject: [PATCH] zsh:keys:rationalize_dots: Add `..` scenario Handle an LBUFFER value of `..` before pressing `.` by adding `/../`. This scenario can only occur by deleting previously added segments or using the new `default_dot` (See previous commit 72a8cfbcb ("zsh:keys: Add normal `.` behaviour on `Ctrl-.`")). --- .config/zsh/zshrc.d/60-keys.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/zsh/zshrc.d/60-keys.zsh b/.config/zsh/zshrc.d/60-keys.zsh index e981477..7fdaf40 100644 --- a/.config/zsh/zshrc.d/60-keys.zsh +++ b/.config/zsh/zshrc.d/60-keys.zsh @@ -86,6 +86,10 @@ function rationalize_dots { # Rationalize dots at BOL or after a space or slash. if [[ "$LBUFFER" =~ "(^|[ /])\.\./$" ]]; then LBUFFER+=../ + elif [[ "$LBUFFER" =~ "(^|[ /])\.\.$" ]]; then + # NOTE: This scenario occurs only if backspace or `default_dot` was + # used. + LBUFFER+=/../ elif [[ "$LBUFFER" =~ "(^|[ /])\.$" ]]; then LBUFFER+=./ else