12

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'

  • What version of OS X/macOS are you running and on what Apple hardware? – user3439894 Feb 15 '18 at 13:51
  • I don't know what you consider the command's length to be in reference to "If the command is longer can take 15 seconds." but the command you've shown is 356 characters long and it pastes instantaneously on my system. If I replicate that command out to 8406 characters long, it pastes in 1 second. So, how many characters qualifies as "If the command is longer can take 15 seconds."? Also, do you get the same results if doing this under a different User on your system, even if you have to temporarily create a new User? – user3439894 Feb 15 '18 at 14:32
  • For me is not instant, that's the problem. The command I post takes 15 seconds to be visible on my command line. Version High Sierra 10.13.2 (But this is happening in other version too) 2.2 Ghz i7, 16Gb Ram ... – Raúl Martín Feb 15 '18 at 18:34
  • You didn't answer the last question from my other comment, which was.... Also, do you get the same results if doing this under a different User on your system, even if you have to temporarily create a new User? – user3439894 Feb 15 '18 at 18:42
18

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:

  • 1
    thanks a lot! pasting a curl command from Google Chrome took 45 seconds! now < 1 sec :) – Gianfranco P. Aug 3 '18 at 8:33
  • you could edit $ZSH/lib/misc.zsh and comment those lines too. Would be easier.. – Nacho Feb 27 at 14:39
  • That is what the awnser said – Raúl Martín Feb 27 at 15:46
1

It seems strange that you can download and use Hyper on macOS, because it seems to be windows only.

General Performance of iTerm

The FAQ from iTerms website suggests this:

Disable transparency and blur. Use a solid background color rather than an image.

You might also want to look into how many Triggers you have activated, as they are known to decrease performance. You can find these in Settings -> Profiles -> Advanced -> Triggers.

Pasting Performance in iTerm

I couldn't replicate your issue on my computer with this short text, but making it about 20 times longer the same happens here. My guess is that iTerm thinks that you are typing and redraws the whole text every time it sees a new character. The same happens on vim in macOS and Ubuntu (see here enter link description here)

Fixing Pasting Performance in iTerm

There does not seem to be an easy fix for these performance problems. If the FAQ did not help I suggest to use this command:

pbpaste >> test.sh && chmod +x test.sh && ./test.sh && rm test.sh

pbpaste accesses the clipboard (try pbpaste on its own) and >> test.sh writes it into the file test.sh. chmod+x test.sh will allow test.sh to be run from the terminal, ./test.sh runs it and rm test.sh will remove all files called test.sh. This works exactly the same as pasting it but without the performance decrease actually pasting it brings

  • Are you talking about other hyper? hyper.is. No opacity or blur. No triggers :( That was promising. pbpaste lit is a very smart line but I will lose velocity by the fact I have to write the command/history/ – Raúl Martín Feb 15 '18 at 18:34
  • Sorry I found that my question was missing some information. Thanks for the time to reply! – Raúl Martín Feb 15 '18 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .