exporting LSCOLORS in .zshrc not working as expected
In my .zshrc
file I am loading my color scheme using the below command:
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
But when I load my terminal I get another color scheme. I am not sure why this is happening. On sourcing
source .zshrc
I get the color scheme. I am not sure why it doesn't load automatically.
I am using prezto
for my zsh shell.
All my aliases present in .zshrc
file load fine.
Solution 1:
I'm guessing you put the LSCOLORS export at the top of the .zshrc? Move it below the zprezto stuff and it will work. The variable gets overwritten when zprezto sets up (hence why it works when you manually source the file a second time - zprezto detects it's already running so it doesn't go through its setup a second time when sourced again). This is why you should always put/source your own stuff as late in the chain as possible, it's the only way to have final say.
You can always rely on simple debugging with echo
with stuff like this. Just inspect the var (both in scripts and interactively) and you can confirm what's going on.