问题
I just set up zsh
together with oh-my-zsh
. But there's a bit of strange behavior that I cannot understand. If I restart Terminal (or iTerm 2––the behavior is the same in either) the theme specified in ~/.zshrc
is not loaded. I need to do source ~/.zshrc
for it to happen. If I echo $ZSH_THEME
I get the theme I specified in ~/.zshrc
. (And if I add echo "I'm loading it."
to the bottom of ~/.zshrc
, for example, I get the expected message upon opening a new window, etc.)
This question is very similar to mine. But none of the suggestions there appear relevant: the problem there was that some bits of ~/.zshrc
were not being loaded, whereas in my case it seems they are being 'read' but not 'loaded' if that's a thing.
In case this is relevant: I do not have any files named .zprofile
or .profile
in my home directory.
Another bit of relevant information. If I change the value of ZSH_THEME
in my .zshrc
file, I need to source it twice in order to activate the new theme.
回答1:
Posting here in case it helps others. The problem was that I was loading the theme after source $ZSH/oh-my-zsh.sh
, so clearly oh-my-zsh
wasn't loading it. (The instructions in the .zshrc
template generated by oh-my-zsh
are a little confusing. On a quick read they suggest that themes should be loaded below the User configuration
line.)
回答2:
For Arch-linux users:
I had to un-install the grml-zsh-config package and reboot:
yay -Rncs grml-zsh-config
来源:https://stackoverflow.com/questions/43402753/oh-my-zsh-not-applying-themes