summaryrefslogtreecommitdiff
path: root/Functions
diff options
context:
space:
mode:
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Zle/select-bracketed2
-rw-r--r--Functions/Zle/surround6
2 files changed, 7 insertions, 1 deletions
diff --git a/Functions/Zle/select-bracketed b/Functions/Zle/select-bracketed
index 00f51be2c..d467bb804 100644
--- a/Functions/Zle/select-bracketed
+++ b/Functions/Zle/select-bracketed
@@ -12,6 +12,8 @@
# done
# done
+setopt localoptions noksharrays
+
local style=${${1:-$KEYS}[1]} matching="(){}[]<>bbBB"
local -i find=${NUMERIC:-1} idx=${matching[(I)[${${1:-$KEYS}[2]}]]}%9
(( idx )) || return 1 # no corresponding closing bracket
diff --git a/Functions/Zle/surround b/Functions/Zle/surround
index b7be30b75..348ceecc2 100644
--- a/Functions/Zle/surround
+++ b/Functions/Zle/surround
@@ -69,7 +69,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