hyper: Very slow paste with `zsh-autosuggestions` enabled

With zsh-autosuggestions enabled, pasting is very slow – I see each character appear, one character every few ms. The same applies to opening the config file with Cmd+, – I see each line of the message “typed” and then executed, over a period of about 2 seconds, before the file opens.

Without zsh-autosuggestions I don’t notice this, so obviously that software is partly to blame, but Hyper is also a factor here because pasting is instant in iTerm even with zsh-autosuggestions.

I believe this is because Hyper sends each character of a pasted string individually, whereas iTerm must be sending the whole string at once.


Hyper 1.0.0 Electron 1.4.7 darwin x64 15.6.0

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 39
  • Comments: 21 (2 by maintainers)

Most upvoted comments

Seems that since some recent version the same workaround than the one suggested by @uv-w can be achieved by setting : DISABLE_MAGIC_FUNCTIONS=true in .zshrc

I’m pretty sure this should be okay with the latest version! Please let us know if it’s not fixed.

Same.

$ echo $ZSH_VERSION
5.3

mkdir $ZSH_CUSTOM/lib/ cp $ZSH/lib/misc.zsh $ZSH_CUSTOM/lib/. vi $ZSH_CUSTOM/lib/misc.zsh

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

image

from: https://apple.stackexchange.com/questions/312795/zsh-paste-from-the-clipboard-a-command-takes-a-few-second-to-be-write-in-the-ter

very slow when pasting a large string $ echo $ZSH_VERSION 5.3

Same here. Excruciatingly slow while pasting long cURLs in zsh with zsh-autosuggestions enabled. I really don’t know why this issue is closed. It’s very much still open. $ echo $ZSH_VERSION 5.3

you need to surround true with double quotes

@adamdoescode @AmjadHussainSyed You don’t need to manually add it; it’s an option in the default. You just need to uncomment the following line in .zshrc:

# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"

My experience is that this does not work. I don’t know why, but only the other solution proposed by @uv-w works for me. Interestingly, I’ve had this problem on both iTerm in MacOS and on Windows in WSL2 Terminal.

What was the suggestion by @uv-w ? It seems like they removed it/changed their name.

edit: I found something that worked for me

autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle ':bracketed-paste-magic' active-widgets '.self-*'

from https://github.com/zsh-users/zsh-autosuggestions/issues/102

@adamdoescode @AmjadHussainSyed

You don’t need to manually add it; it’s an option in the default. You just need to uncomment the following line in .zshrc:

# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"

@uv-w’s suggestion worked for me where DISABLE_MAGIC_FUNCTIONS=true failed to fix the problem. I am using iterm with zsh 5.8 on a 2020 13’ mac intel processor.