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

+3


source to share


3 answers


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 to

    autoload -U colors && colors
    
          

    on .zshrc

    .

  • PROMPT

    is one-stage and is not analyzed. You need to use the option PROMPT_SUBST

    to parse the prompt string. Add to

    setopt 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

      

+6


source


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 spectrum.zsh

from Oh-my-zsh (if you don't want to run the whole package) to your original list or
(not enough, see comments) overriding the colors in the default zsh color prompt . You can play with colors using the function spectrum_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): Zsh prompt examples



Edit:

See 4ae1e1's answer for individual requirements (Oh-my-zsh automatically installs them).

0


source


PATH

has single quotes by default and is not parsed because of this. Rewrite var variable with double quote

PATH="$PATH"
source ~/.antigen.zsh
antigen theme jdavis/zsh-files themes/jdavis

      

0


source







All Articles