zsh:keys:rationalize_dots: Add comments

This commit is contained in:
2022-09-22 15:14:38 +02:00
parent 8792518bcb
commit 9a5536c5c5

View File

@@ -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+=.