zsh-users
 help / color / mirror / code / Atom feed
* Shift-Insert erratic behavior in edit-command-line vim
@ 2016-10-25 12:48 lolilolicon
  2016-10-25 13:05 ` lolilolicon
  2016-10-25 16:25 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: lolilolicon @ 2016-10-25 12:48 UTC (permalink / raw)
  To: zsh-users

I use ESC-e (edit-command-line) to edit the current command line in vim.
Usually in vim Insert mode, I can use Shift-Insert to insert X PRIMARY
selection, but for some reason, it doesn't work here.
Instead, vim would enter Normal mode and execute... something, e.g.,

% abc
ESC-e executes: /usr/bin/vim -c "normal! 4go" -- /tmp/zshzgtQpk

Inside vim, press "i" to enter Insert mode,

abc

The content of my PRIMARY selection is "x". Press Shift-Insert, becomes

ac

Vim has entered Normal mode.
Now I press "u" (3 times) to undo and see what happened,
Ac
Abc
abc

I have no idea how this happened.

So, can you reproduce this?
Why is it happening and how to solve it?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Shift-Insert erratic behavior in edit-command-line vim
  2016-10-25 12:48 Shift-Insert erratic behavior in edit-command-line vim lolilolicon
@ 2016-10-25 13:05 ` lolilolicon
  2016-10-25 16:25 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: lolilolicon @ 2016-10-25 13:05 UTC (permalink / raw)
  To: zsh-users

On Tue, Oct 25, 2016 at 8:48 PM, lolilolicon <lolilolicon@gmail.com> wrote:
> I use ESC-e (edit-command-line) to edit the current command line in vim.
> Usually in vim Insert mode, I can use Shift-Insert to insert X PRIMARY
> selection, but for some reason, it doesn't work here.
> Why is it happening and how to solve it?

FYI, I'm aware of the * register, and I do use "*p regularly.
However I'm really scratching my head here why Shift-Insert is broken
in this case.
If I run the "/usr/bin/vim -c ..." command line manually, this does not occur.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Shift-Insert erratic behavior in edit-command-line vim
  2016-10-25 12:48 Shift-Insert erratic behavior in edit-command-line vim lolilolicon
  2016-10-25 13:05 ` lolilolicon
@ 2016-10-25 16:25 ` Bart Schaefer
  2016-10-25 16:40   ` lolilolicon
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-10-25 16:25 UTC (permalink / raw)
  To: zsh-users

On Oct 25,  8:48pm, lolilolicon wrote:
}
} I use ESC-e (edit-command-line) to edit the current command line in vim.
} Usually in vim Insert mode, I can use Shift-Insert to insert X PRIMARY
} selection, but for some reason, it doesn't work here.
} Instead, vim would enter Normal mode and execute... something

Another side-effect of bracketed-paste.  Fixed in the forthcoming 5.3
release; partial patch was posted in zsh-users/20873, but here is the
full set of changes.

diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 103a1c1..353f260 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 -r -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 -r -n - $zle_bracketed_paste[1]
+
   # Replace the buffer with the editor output.
   print -Rz - "$(<$1)" 
 } =(<<<"$PREBUFFER$BUFFER")

-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Shift-Insert erratic behavior in edit-command-line vim
  2016-10-25 16:25 ` Bart Schaefer
@ 2016-10-25 16:40   ` lolilolicon
  0 siblings, 0 replies; 4+ messages in thread
From: lolilolicon @ 2016-10-25 16:40 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Wed, Oct 26, 2016 at 12:25 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> Another side-effect of bracketed-paste.  Fixed in the forthcoming 5.3
> release; partial patch was posted in zsh-users/20873, but here is the
> full set of changes.
Awesome, glad to hear that.
I'v applied the patch. Works alright. Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-25 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 12:48 Shift-Insert erratic behavior in edit-command-line vim lolilolicon
2016-10-25 13:05 ` lolilolicon
2016-10-25 16:25 ` Bart Schaefer
2016-10-25 16:40   ` lolilolicon

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).