I've build myself this little script for zsh, to copy & paste within zsh to the system clipboard (basically got everything from here: zsh copy and paste like emacs)x-yank() {    zle copy-region-as-kill    print -rn -- $CUTBUFFER | pbcopy}zle -N x-yankx-cut() {    zle kill-region    print -rn -- $CUTBUFFER | pbcopy}zle -N x-cutx-paste() {    CUTBUFFER=$(pbpaste)    zle yank}zle -N x-pastebindkey -M vicmd y x-yankbindkey -M vicmd Y x-cutbindkey -M vicmd p x-pasteHowever, there are a few minor problems, which I can't seem to get fixed:Pasting will remove the current char which under the cursor, I would much prefer the Vim way, to insert it afterwards.Copying will not remove the selection.Any ideas where to get started?
copy&paste in zsh
zsh;clipboard
Ok, figured it out, I could just manipulate the different buffers directly:x-paste() {    PASTE=$(pbpaste)    LBUFFER=$LBUFFER${RBUFFER:0:1}    RBUFFER=$PASTE${RBUFFER:1:${#RBUFFER}}}zle -N x-pastebindkey -M vicmd p x-paste