Use `fish_color_at` to decide the colour of the @ (if present) in the prompt
Description
As discussed here, you can't easily change the colour of the @ in the prompt (if present).
This draft proposes a fix.
TODOs:
- [ ] Discuss if this is the correct way to do it.
- [ ] Update all themes, adding
fish_color_at=normal, so that they all render the same if the user doesn't specify. - [ ] Do something similar for any trailing prompt character? (in the linked issue, the user can't change the colour of the
>)
how about
functions -c fish_prompt default_fish_prompt
function fish_prompt
default_fish_prompt | string replace @ (set_color red)@
end
how about
I guess that's a workaround, but it doesn't allow individual themes to describe their desired colour.
is there any theme that wants to this to be different than $fish_color_normal?
If not then we can do
diff --git a/share/functions/prompt_login.fish b/share/functions/prompt_login.fish
index 632a462bd..3ec1647fd 100644
--- a/share/functions/prompt_login.fish
+++ b/share/functions/prompt_login.fish
@@ -26,3 +26,3 @@ function prompt_login --description "display user name for the prompt"
- echo -n -s (set_color $fish_color_user) "$USER" (set_color normal) @ (set_color $color_host) (prompt_hostname) (set_color normal)
+ echo -n -s (set_color $fish_color_user) "$USER" (set_color $fish_color_normal) @ (set_color $color_host) (prompt_hostname) (set_color normal)
end
AFAICT fish_color_normal is used as fallback for syntax highlighting on text that doesn't have a distinguishing role, or for cases where the highlighting for that role has been explicitly disabled (such as set -e fish_color_command ).
I think that's a relatively obvious approach. In future we should also give prompt variables like $fish_color_user the same behavior of falling back to $fish_color_normal if unset.
I'm closing this for now.