I recently moved from bash to zsh and use vim keybindings in zsh. 
When I highlight a string in visual and yank it with y, I can then paste it inside of zsh without problem. However when I try to paste that same string outside of zsh (with the command Ctrl + d) it does not work. Instead the last copied item with Ctrl + c is copied there.
Is there an additional command to write in the .zshrc?
By default zsh yanks to its own internal registers. Luckily, like in Vim, it's fairly simple yank to the system clipboard.
# vi mode
bindkey -v
# Yank to the system clipboard
function vi-yank-xclip {
    zle vi-yank
   echo "$CUTBUFFER" | pbcopy -i
}
zle -N vi-yank-xclip
bindkey -M vicmd 'y' vi-yank-xclip
Replace pbcopy with the method of your system, for example xclip if you're on Linux.
Further reading and a couple alternatives at:
(Which this question is a duplicate of.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With