Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've begun making my own oh-my-zsh theme, but I've run into a bit of a problem. I'm trying to change the color of the git output based on the name of the branch, and it works fine except for one important caveat: it changes the color to the correct one when zsh launches, but never re-evaluates what the color should be unless I re-launch zsh.

Here's a screenshot of the problem in action:

Screenshot of the problem

Here's a gist with my current zsh theme.

Am I doing something wrong, or does oh-my-zsh or zsh not support this kind of thing?

share|improve this question
add comment

1 Answer

I haven't used oh-my-zsh (uh-oh) but I do use zsh and it and other shells do not reload configuration files between commands. You must explicitly reload them with the source command:

source ~/.zsh_config_file_you_modified_or_another_file

or

. ~/.zsh_config_file_you_modified_or_another_file

Starting a new zsh shell does that (completely with a new login shell, partially with a new sub shell as you did in the right pane above).

The complete list of which zsh config files are loaded on login vs normal shells is:

╔════════════════╦═══════════╦═══════════╦══════╗  
║                ║Interactive║Interactive║Script║  
║                ║login      ║non═login  ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║/etc/zshenv     ║    A      ║    A      ║  A   ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║~/.zshenv       ║    B      ║    B      ║  B   ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║/etc/zprofile   ║    C      ║           ║      ║   
╠════════════════╬═══════════╬═══════════╬══════╣   
║~/.zprofile     ║    D      ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║/etc/zshrc      ║    E      ║    C      ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║~/.zshrc        ║    F      ║    D      ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║/etc/zlogin     ║    G      ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║~/.zlogin       ║    H      ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║                ║           ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║                ║           ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║~/.zlogout      ║    I      ║           ║      ║  
╠════════════════╬═══════════╬═══════════╬══════╣  
║/etc/zlogout    ║    J      ║           ║      ║  
╚════════════════╩═══════════╩═══════════╩══════╝  

If the files exist, they are loaded in A first, then B, C, D etc. I and J are only loaded/run on logging out / exiting a login shell.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.