How can I setup fish shell prompt to be in a different color?
13,225
Sammyg was correct that set_color
is what you're looking for. The trick is that a single call to set_color
doesn't color a specified block of text, but sets the color that all subsequent text will be printed. The -b
flag sets the background color. Here's a simple function which will give you a similar effect to that zsh
prompt (put it in your fish/functions
directory):
function fish_prompt
set -l textcol white
set -l bgcol blue
set -l arrowcol green
set_color $textcol -b $bgcol
echo -n " "(basename $PWD)" "
set_color $arrowcol -b normal
echo -n "⮀ "
end
Note that you don't need to explicitly reset the colors after drawing the prompt, fish
will do that automatically.
Related videos on Youtube
Author by
Max Yankov
Updated on September 18, 2022Comments
-
Max Yankov over 1 year
I've seen a screenshot of zsh configured to have prompt with a different color and background, and it looks like a very usable tweak:
-
Samir about 10 yearsSee if this is of any help.
-
Max Yankov about 10 yearsIf I understand correctly, it only changes the color for the whole terminal, not the prompt.
-