美文网首页
iTerm使用zsh-autosuggestions插件后导致粘

iTerm使用zsh-autosuggestions插件后导致粘

作者: 桃木子不言 | 来源:发表于2020-08-24 09:35 被阅读0次

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重新使配置生效,或者重新打开终端,再尝试下,如丝般顺滑。

相关文章

网友评论

      本文标题:iTerm使用zsh-autosuggestions插件后导致粘

      本文链接:https://www.haomeiwen.com/subject/fdzjdktx.html