There is a problem when cutting or copying and pasting a multi-line text when using this plugin, I'll explain with an example:
Start with a multi-line buffer like this (extracted from our license):
share and change all versions of a program--to make sure it remains free
GNU General Public License for most of our software; it applies also to
software for all its users. We, the Free Software Foundation, use the
If you will copy this and paste it in an empty $BUFFER, it will be pasted fine. How ever, if you'll try to replace the 2nd line with the 3rd for example - by pressing dd and then p (with the default mappings) you'll get the following result:
share and change all versions of a program--to make sure i
t remains free
sGNU General Public License for most of our software; it applies also tooftware for all its users. We,
the Free Software Foundation, use the
That happens because our alias zsh-system-clipboard-set (it happens even with a function) trims newlines from the $CUTBUFFER because we use printf '%s' and not printf '%s\n' in zsh-system-clipboard-vicmd-vi-delete or zsh-system-clipboard-vicmd-vi-yank. Never the less, we can't use in these functions printf '%s\n' unconditionally because this would imply that every yank or delete operation was done on a whole line.
Additionally, zsh-system-clipboard-vicmd-vi-put-after and zsh-system-clipboard-vicmd-vi-put-before should know how to handle newlines correctly. This is even more problematic then you think since these functions will read the clipboard from zsh-system-clipboard-get without a trailing new line (see this Stack Exchange question).
There is a problem when cutting or copying and pasting a multi-line text when using this plugin, I'll explain with an example: Start with a multi-line buffer like this (extracted from our license):
If you will copy this and paste it in an empty
$BUFFER
, it will be pasted fine. How ever, if you'll try to replace the 2nd line with the 3rd for example - by pressingdd
and thenp
(with the default mappings) you'll get the following result:That happens because our alias
zsh-system-clipboard-set
(it happens even with a function) trims newlines from the$CUTBUFFER
because we useprintf '%s'
and notprintf '%s\n'
inzsh-system-clipboard-vicmd-vi-delete
orzsh-system-clipboard-vicmd-vi-yank
. Never the less, we can't use in these functionsprintf '%s\n'
unconditionally because this would imply that every yank or delete operation was done on a whole line.Additionally,
zsh-system-clipboard-vicmd-vi-put-after
andzsh-system-clipboard-vicmd-vi-put-before
should know how to handle newlines correctly. This is even more problematic then you think since these functions will read the clipboard fromzsh-system-clipboard-get
without a trailing new line (see this Stack Exchange question).I'll propose a fix for that shortly.