I changed input mode in zsh to vi with set -o vi, but that created problems with pasting text.

While trying to do cmd-v (MacOS) in the insert mode, zsh is pasting only a fraction of the clipboard content. It seems like zsh is trying to execute the clipboard content as if its characters were commands. (Perhaps cmd-v sends zsh into the visual mode or something.)

Meanwhile, clipboard paste works fine in vim and bash. It works in iTerm and Terminal. But not with zsh. I use oh-my-zsh with vi-mode plugin disabled (it has the same problem).

Is this a bug or normal behavior?

  • 1
    What version of zsh? Recent versions have a new bracketed paste mode; revert to the old behaviour via unset zle_bracketed_paste – thrig May 5 '16 at 17:53
  • @thrig zsh 5.2. I tried adding unset zle_bracketed_paste to ~/.zshrc, but it still behaves like this. – Anton Tarasenko May 5 '16 at 18:40
  • 2
    Can you try without all of the “oh-my-zsh” stuff? I run ZSH in Vi mode on my Mac without it and have no problems. Would be useful to narrow it down to ZSH or “oh-my-zsh” – forquare May 5 '16 at 19:35
  • @forquare Thanks for suggestion. Checked. It's oh-my-zsh-only problem. – Anton Tarasenko May 5 '16 at 21:17

Thanks to @forquare's reminder, I checked oh-my-zsh config and discovered the problem: plugin safe-paste.

After removing safe-paste from ~/.zshrc, pasting works in the vi mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.