From 9a5536c5c5d33e2be28be33638e1c7571630b230 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 22 Sep 2022 15:14:38 +0200 Subject: [PATCH] zsh:keys:rationalize_dots: Add comments --- .config/zsh/zshrc.d/60-keys.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/zsh/zshrc.d/60-keys.zsh b/.config/zsh/zshrc.d/60-keys.zsh index 7fdaf40..55b44a3 100644 --- a/.config/zsh/zshrc.d/60-keys.zsh +++ b/.config/zsh/zshrc.d/60-keys.zsh @@ -85,12 +85,15 @@ bindkey -M vicmd " f" edit-fuzzy-file 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 LBUFFER+=.