Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zsh theme not working properly on OSX

Tags:

macos

zsh

Just got started with zsh yesterday but I'm having a lot of trouble getting themes to work. Here is what is showing on my ZSH prompt:

$fg[cyan][$fg[white] keithy $fg[cyan]] [$fg[white]~/Desktop$fg[cyan]] >$reset_color

My ~/.zshrc

source ~/.antigen.zsh

antigen theme jdavis/zsh-files themes/jdavis

Thanks

like image 233
Keith Avatar asked Oct 27 '25 10:10

Keith


1 Answers

TL;DR: Corrected .zshrc is provided at the bottom. You might want to try it first, see it working, then come back to read the explanations.


Inspecting antigen.zsh and jdavis.zsh-theme, it looks like you have two problems:

  1. You haven't loaded and executed the colors function anywhere. Add

    autoload -U colors && colors
    

    to your .zshrc.

  2. PROMPT is single-quoted and not parsed. You need to use the PROMPT_SUBST option option to parse the prompt string. Add

    setopt promptsubst
    

    to your .zshrc. What the option does, according to the linked documentation:

    If set, parameter expansion, command substitution and arithmetic expansion are performed in prompts. Substitutions within prompts do not affect the command status.

So your .zshrc should look like

source ~/.antigen.zsh
autoload -U colors && colors
setopt promptsubst
antigen theme jdavis/zsh-files themes/jdavis
like image 143
4ae1e1 Avatar answered Oct 30 '25 09:10

4ae1e1