iTerm使用zsh-autosuggestions插件后导致粘贴长文本内容时输入很慢

iTerm使用autosuggestions 插件后,在终端中粘贴CURL内容的时候很慢,基本上是一个字符一个字符输入的,想打字机一样,真的受不了,太影响效率了。

解决方案

.zshrc文件中配置以下内容:

# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
  OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
  zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
 
pastefinish() {
  zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish

在终端输入source .zshrc重新使配置生效,或者重新打开终端,再尝试下,如丝般顺滑。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。