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-.`")).
This commit is contained in:
2022-09-22 15:09:39 +02:00
parent 72a8cfbcb0
commit 8792518bcb

View File

@@ -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