ZSH paste from the clipboard a command takes a few second to be write in the terminal When I copy from the clipboard a long string command in my iTerm, the terminal freeze for seconds.

for example, if I copy the following test and I paste in my iTerm console:

echo 'test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test'

take a couple of seconds to be written in the terminal.

If the command is longer can take 15 seconds. 

ZSH version '5.3'
The final problem is related to zsh. 

oh-my-zsh is executing bracketed-paste-magic, so I ended up removing it.
Because oh-my-szh doesn't have a plugin manager for this. You have to override the file: $ZSH/lib/misc.zsh

The overrides will be in this folder $ZSH_CUSTOM.

Because I don't have any override I had to create the folder first:
mkdir $ZSH_CUSTOM/lib/

And create a copy of the original
cp $ZSH/lib/misc.zsh $ZSH_CUSTOM/lib/.

and edit the file (use your favorite editor):

vi $ZSH_CUSTOM/lib/misc.zsh

I commented the following lines, but you can remove it or change the if condition.

#if [[ $ZSH_VERSION != 5.1.1 ]]; then
#  for d in $fpath; do
#       if [[ -e "$d/url-quote-magic" ]]; then
#               if is-at-least 5.1; then
#                       autoload -Uz bracketed-paste-magic
#                       zle -N bracketed-paste bracketed-paste-magic
#               fi
#               autoload -Uz url-quote-magic
#               zle -N self-insert url-quote-magic
#      break
#       fi
#  done
#fi


Thanks and sorry for the question description, without the knowledge that I was using zsh this made the task to help me impossible to accomplish.

More info:


https://github.com/robbyrussell/oh-my-zsh/issues/5569
https://github.com/robbyrussell/oh-my-zsh/issues/6338