Zsh 下粘贴中文字符出现乱码

前言:在 zsh 下想粘贴中文的字符,但是中文字符粘贴后就是乱码,这里介绍一种解决的方法。

乱码效果如下图所示:

zsh-messy-code

修改路径为~/.oh-my-zsh/lib下的 misc.zsh 文件:

1
2
3
4
# *-magic is known buggy in some versions; disable if so
-if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
+if [[ $DISABLE_MAGIC_FUNCTIONS = true ]]; then
for d in $fpath; do

修改之处如绿色字体部分,将判断条件 $DISABLE_MAGIC_FUNCTIONS != true 修改为 $DISABLE_MAGIC_FUNCTIONS = true。之后重启 zsh 即可。