Here is my suggestion of fish_prompt function to print a colorful gentoo-ish prompt (so fish can look like bash). I've just edited the function already available at /usr/share/fish/functions/fish_prompt.fish and copied that to my ~/.config/fish/config.fish. I've tested with app-shells/fish-1.22.1 # Colorful gentoo-ish fish prompt: function fish_prompt -d (N_ "Write out the prompt") # Just calculate these once, to save a few cycles when displaying the prompt if not set -q __fish_prompt_hostname set -g __fish_prompt_hostname (hostname|cut -d . -f 1) end if not set -q __fish_prompt_normal set -g __fish_prompt_normal (set_color normal) end if test (id -u) = 0 printf '%s%s %s%s%s> ' (set_color -o red) $__fish_prompt_hostname (set_color -o blue) (prompt_pwd) "$__fish_prompt_normal" else printf '%s%s@%s %s%s%s> ' (set_color -o green) $USER $__fish_prompt_hostname (set_color -o blue) (prompt_pwd) "$__fish_prompt_normal" end end Some comments: 1. I use (id -u) instead of $USER because I want to know the effective UID ($EUID, in bash). It may happen that the current EUID is zero (root), but the UID is from another user. Since I don't know if fish has any $EUID-like variable, I'm running (id -u). If you know a better way of doing this, please, update this code. 2. I'm calling (set_color) multiple times. Probably I shouldn't, and I should store them at global vars (like $__fish_prompt_normal). Please, feel free to improve this. I don't know if gentoo guys think it is a good idea to change the default prompt colors for fish (even though you do it for bash). Anyway, I just wanted to share this function to other people, and make the job easier for gentoo devs if someday they want to do such customization on gentoo's fish.
This sounds like a good idea. Could you test it out with 1.23.0? I haven't tried your prompt, does it exactly mirror the bash one?
It mirror(In reply to comment #1) > This sounds like a good idea. Could you test it out with 1.23.0? I haven't > tried your prompt, does it exactly mirror the bash one? It mirrors gentoo-bash colors, but it keeps " >" at the end. (while bash uses " $" or " #" at the end) I haven't installed 1.23.0 yet. BTW, that code I submitted can have some improvements (I have some in my mind, I might code these improvements soon). I'm not sure, but I think that gentoo should add a file at /etc/fish/functions/fish_prompt.fish, instead of patching the original /usr/share/fish/functions/fish_prompt.fish. I've tested neither of them, yet. What do you think?
/etc is for user changes; a distro change should still go into /usr.
(In reply to comment #3) > /etc is for user changes; a distro change should still go into /usr. Why, then, such change in bash was done in /etc/bash/bashrc? Lack of /usr/ files for bash? IMHO, the advantage about making this change in /etc/ is to leave the original unmodified version at /usr, so the user may be able to read the original. (ok, ok, the user may also get the tarball and uncompress it)
bash has no system defaults in /usr like fish does. hal might be a better comparison -- it installs some fdi files to /usr and system overrides of them go in /etc.
Created attachment 255097 [details, diff] Patch to allow newlines (\n) in fish prompt I found the patch here: http://benhoskin.gs/2009/11/25/multi-line-prompts-in-fish/ I applied it on my system and it worked like a champ. I hope this was the right place for me to submit the patch. I could start a new bug if you want me to.
+ 12 Nov 2011; Michael Weber <xmw@gentoo.org> +fish-1.23.1-r2.ebuild, + +files/fish-1.23.1-multi-line_prompts.patch: + Revbump to optionally include multi-line prompt patch by Ben Hoskings as + suggested by James Bowlin (bug 205809) +
I believe there was some confusion here. This bug (that is an "enhancement") was about adding a colorful Gentoo prompt, similar to the bash prompt. Then James Bowlin posted an unrelated patch here, which was accepted and then this bug was closed, even though the summary of the bug was not "fixed". I'm changing the summary to reflect the accepted patch.