Zsh theme does not work as expected on OSX
Just started with zsh yesterday, but I'm having a lot of problems getting the themes to work. This is what appears 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
thank
source to share
TL; DR: Fixed .zshrc
shown below. You might want to try it first, see how it works and then come back to read the explanations.
Checking antigen.zsh
and jdavis.zsh-theme
it looks like you have two problems:
-
You haven't downloaded and executed the
colors
function anywhere. Add toautoload -U colors && colors
on
.zshrc
. -
PROMPT
is one-stage and is not analyzed. You need to use the optionPROMPT_SUBST
to parse the prompt string. Add tosetopt promptsubst
to your
.zshrc
. What this option does, according to the linked documentation:If set, parameter expansion, command substitution, and arithmetic expansion are performed on queries. Substitutions in queries do not affect the state of the command.
So yours .zshrc
should look like
source ~/.antigen.zsh
autoload -U colors && colors
setopt promptsubst
antigen theme jdavis/zsh-files themes/jdavis
source to share
It looks like you are trying to use the color-coded hint from Oh-my-zsh , and you may not have defined those colors. Try adding a file (not enough, see comments) overriding the colors in the default zsh color prompt . You can play with colors using the function spectrum.zsh
from Oh-my-zsh (if you don't want to run the whole package) to your original list orspectrum_ls
defined in spectrum.zsh
, or by changing the numerical values ββin this one-line (051 is bright blue):
zsh -c 'print -P -- "%F{051}Hello, World%f"'
Below is an example of a prompt with no colors specified (top) and a prompt where Oh-my-zsh was received prior to definition PROMPT
(bottom):
Edit:
See 4ae1e1's answer for individual requirements (Oh-my-zsh automatically installs them).
source to share