summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-12-11 05:28:10 +0100
committerOliver Kiddle <opk@zsh.org>2015-12-11 05:34:48 +0100
commitf546ea64df835d35f99f3a6c2c6767caab3359a3 (patch)
tree402dd3fef571cd22f240c93a823cfa012f7dcde2
parenta5233fd01e9ab4953b7ff8b4cc031485b414b8e3 (diff)
downloadzsh-f546ea64df835d35f99f3a6c2c6767caab3359a3.tar.gz
zsh-f546ea64df835d35f99f3a6c2c6767caab3359a3.zip
users/20873: disable bracketed paste while running external editor from zle
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zle/edit-command-line10
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d1db73e0c..d1bd1e1f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-11 Oliver Kiddle <opk@zsh.org>
+
+ * users/20873: Functions/Zle/edit-command-line: disable bracketed
+ paste while running external editor from zle
+
2015-12-10 Peter Stephenson <p.stephenson@samsung.com>
* 37378: Src/Modules/zpty.c, Test/X03zlebindkey.ztst,
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 103a1c1a5..b8145525f 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -1,8 +1,8 @@
# Edit the command line using your usual editor.
-# Binding this to 'v' in the vi command mode map,
+# Binding this to '!' in the vi command mode map,
# autoload -Uz edit-command-line
# zle -N edit-command-line
-# bindkey -M vicmd v edit-command-line
+# bindkey -M vicmd '!' edit-command-line
# will give ksh-like behaviour for that key,
# except that it will handle multi-line buffers properly.
@@ -10,7 +10,9 @@
exec </dev/tty
# Compute the cursor's position in bytes, not characters.
- setopt localoptions nomultibyte
+ setopt localoptions nomultibyte noksharrays
+
+ (( $+zle_bracketed_paste )) && print -n $zle_bracketed_paste[2]
# Open the editor, placing the cursor at the right place if we know how.
local editor=${${VISUAL:-${EDITOR:-vi}}}
@@ -24,6 +26,8 @@
(*) ${=editor} $1;;
esac
+ (( $+zle_bracketed_paste )) && print -n $zle_bracketed_paste[1]
+
# Replace the buffer with the editor output.
print -Rz - "$(<$1)"
} =(<<<"$PREBUFFER$BUFFER")