昨天我突然丢失了所有 ZSH 设置,更具体地说是提示符以及主题的应用方式。到目前为止,我尝试了以下方法:
正如 ZSH FAQ 中建议的那样,我尝试过,
exec zsh
但只在当前终端中有效。即使我打开新的终端选项卡,进程也不会在那里运行。卸载并重新安装 ZSH。没有任何变化。
尝试向文件添加不同的提示格式
.zshrc
。它也只在我运行时才有效exec zsh
。这让我相信配置文件未被读取,但我不知道如何纠正这个问题。
我不确定在这种情况下什么信息会有帮助,所以不确定还能分享什么。我会在问题更新时提供更多信息。
基本信息:
操作系统:MacOS Monterey 12.6.1
Mac:MacBook Pro 2021(2021 年)
提前谢谢你的帮助。
编辑:
运行zsh -o sourcetrace
后输出结果如下:
+/etc/zshrc:1> <sourcetrace>
+/etc/zshrc_Apple_Terminal:1> <sourcetrace>
+/Users/sanieakhtar/.zshrc:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/oh-my-zsh.sh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/tools/check_for_upgrade.sh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/cache/.zsh-update:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/compfix.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.zcompdump-sanieakhtar-5.8.1:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/bzr.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/cli.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/clipboard.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/compfix.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/completion.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/correction.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/diagnostics.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/directories.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/functions.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/git.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/grep.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/cache/grep-alias:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/history.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/key-bindings.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/misc.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/nvm.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/prompt_info_functions.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/spectrum.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/termsupport.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/theme-and-appearance.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/lib/vcs_info.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/plugins/git/git.plugin.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/custom/example.zsh:1> <sourcetrace>
+/Users/sanieakhtar/.oh-my-zsh/themes/robbyrussell.zsh-theme:1> <sourcetrace>
答案1
你可以通过以下方式启动 Zsh 并进入调试模式
zsh -xo sourcetrace
然后,您将看到启动 shell 时加载的所有文件和执行的所有代码。