summaryrefslogtreecommitdiff
path: root/Functions/Zle/surround
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/Zle/surround')
-rw-r--r--Functions/Zle/surround7
1 files changed, 6 insertions, 1 deletions
diff --git a/Functions/Zle/surround b/Functions/Zle/surround
index b7be30b75..b51b77c04 100644
--- a/Functions/Zle/surround
+++ b/Functions/Zle/surround
@@ -19,6 +19,7 @@ local before after
local -A matching
matching=( \( \) \{ \} \< \> \[ \] )
+zle -f vichange
case $WIDGET in
change-*)
local MARK="$MARK" CURSOR="$CURSOR" call
@@ -69,7 +70,11 @@ case $WIDGET in
before="${(k)matching[(r)[$before:q]]}"
fi
CUTBUFFER="$before$CUTBUFFER$after"
- zle .vi-put-after -n 1
+ if [[ CURSOR -eq 0 || $BUFFER[CURSOR] = $'\n' ]]; then
+ zle .vi-put-before -n 1
+ else
+ zle .vi-put-after -n 1
+ fi
CUTBUFFER="$save_cut" CURSOR="$save_cur"
;;
esac