升级 zsh 后完成停止工作

yon*_*ong 7 zsh autocomplete upgrade

以前我一直在使用这个方便的脚本oh-my-zsh来设置标签颜色,每当我 ssh 进入机器时:

# iTerm2 window/tab color commands
#   http://code.google.com/p/iterm2/wiki/ProprietaryEscapeCodes
tab-color() {
    echo -ne "\033]6;1;bg;red;brightness;$1\a"
    echo -ne "\033]6;1;bg;green;brightness;$2\a"
    echo -ne "\033]6;1;bg;blue;brightness;$3\a"
}
tab-reset() {
    echo -ne "\033]6;1;bg;*;default\a"
    trap - INT EXIT
}

# Change the color of the tab when using SSH
# reset the color after the connection closes
color-ssh() {
    if [[ -n "$ITERM_SESSION_ID" ]]; then
        trap "tab-reset" INT EXIT
        if [[ "$*" =~ "production|ec2-.*compute-1" ]]; then
            tab-color 255 0 0
        else
            tab-color 144 181 80 #0 255 0
        fi
    fi
    ssh $*
}
compdef _ssh color-ssh=ssh

alias ssh=color-ssh
Run Code Online (Sandbox Code Playgroud)

然而,今天我发现自动完成现在坏了!ssh如果我运行此脚本,我将不再自动完成。我如何诊断正在发生的事情?

编辑:禁用oh-my-zsh和获取文件导致错误:command not found: compdef

yon*_*ong 12

好的,我找到了解决方案:删除所有zcompdump文件解决了问题:

rm ~/.zcompdump*
Run Code Online (Sandbox Code Playgroud)


Str*_*ker 5

我运行了以下命令并修复了选项卡完成。

autoload -U compinit && compinit
autoload -U bashcompinit && bashcompinit
Run Code Online (Sandbox Code Playgroud)