为什么需要为iTerm中的每个新Shell都获取.zshrc? [英] Why do you need to source .zshrc for every new shell in iTerm?
问题描述
在过去的3年中,我每天都在zsh中使用Iterm2,但是我有一台新计算机,因此必须重新设置它.问题是,当我运行~/.zshrc
时,它可以正常工作,但是我必须在打开的每个新终端窗口上执行此操作.不好的体验.
I've used Iterm2 with zsh everyday for the past 3 years, but I got a new computer and had to set it up again. The problem is that when I run ~/.zshrc
it works fine, but I have to do it on every new terminal window I open. Not a good experience.
我注意到我的新计算机上没有任何bashrc
,bash_profile
或profile
(点)文件.
I noticed that I don't have any bashrc
, bash_profile
, or profile
(dot)files on my new machine.
这是~/.zshrc
中的代码:
export ZSH=/Users/healy/.oh-my-zsh
plugins=(
git
)
ZSH_THEME="agnoster"
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
DEFAULT_USER=healy
同样,它可以完美运行(并且符合预期),但是只有在我运行source命令之后,事实并非如此.
Again, it works perfectly (and as expected), but only after I run the source command, and that shouldn't be the case.
推荐答案
确保将导出/源添加到zshrc中的插件之后,如这篇文章中所述: oh-my-zsh配置文件未加载
Make sure your export/source are added after the plugins in your zshrc, as stated in this post: oh-my-zsh config file not loading
这篇关于为什么需要为iTerm中的每个新Shell都获取.zshrc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!