I've been trying to make a custom fish prompt, but there's one problem that I can't seem to figure out how to fix.

I got this to work, but it's not exactly what I want, as I want the ash@cat-box to be green working fish prompt

Here's the one I tried to make it exactly what I wanted, but a lot of things get messed up in it and I don't understand why or how to fix it. not working fish prompt

I would appreciate any help getting my prompt to work and explaining why it's doing what it does.

  • Add more information, e.g. what have you tried and how exactly did you try and the complete Fish configs. Commented Jan 9, 2023 at 23:15

1 Answer 1


The issue is missing %s format specifiers in printf. %s tells printf to substitute an argument as a string. If you add more strings (in this case, the new calls to set_color) it will not know where to put them, so they just get added to the end.

A direct fix is to add more %s specifiers:

printf '%s%s@%s%s:%s%s%s$' (set_color green) $USER $hostname (set_color normal) \
                           (set_color blue) (prompt_pwd) (set_color normal)

however this is getting a little unwieldy; it might be more clear if these were broken up into separate commands:

function fish_prompt
    set_color green
    printf '%s@%s' $USER $hostname
    set_color normal
    printf ':'
    set_color blue
    printf '%s' (prompt_pwd)
    set_color normal
    printf '$ '

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .