jorgebucaran / hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
MIT License
626 stars 53 forks source link

additional variables to customize prompt #51

Open XelorR opened 7 months ago

XelorR commented 7 months ago

It would be nice to have some "blank" variables which can be used to add user-defined functionality.

You can always add your functionality like this:

functions --copy fish_prompt fish_prompt_origin
function fish_prompt
    echo -n \n"$os_icon "
    fish_prompt_origin
end

in your config.fish

But what if you want to add git branch icon? You can edit fish_prompt.fish or row 95 in hydro.fish, but it would be much better to just use specific variable for it.

I think following variables would be useful:

hydro_prompt_prefix hydro_prompt_suffix hydro_pwd_prefix hydro_pwd_suffix hydro_git_prefix hydro_git_suffix hydro_duration_prefix hydro_duration_suffix

Or maybe prefixes only are enough.

It can use existing colors for simplification. E.g. hydro_pwd_prefix could be colored by hydro_color_pwd.

It can be used to add icons or additional user-defined functionality.

jorgebucaran commented 7 months ago

Is this just static text, not dynamic (#37)? If that's the case, I don't see how it could pose a performance issue, so I am okay with it. 👍

XelorR commented 7 months ago

Static. Not dynamic. Main idea is to keep it fast and simple but more flexible if someone wants to add icons, decorations or results of their own functions.

XelorR commented 7 months ago

https://github.com/jorgebucaran/hydro/compare/main...XelorR:hydro:prefix_vars

Tried to implement but passing additional variable before git branch name (row 95 in hydro.fish) doesn't seem to work...

Experimenting with following settings

set --global hydro_color_prompt 94e2d5
set --global hydro_color_error f38ba8
set --global hydro_color_pwd b4befe
set --global hydro_color_git f9e2af
set --global hydro_color_duration 94e2d5
set --global hydro_multiline true

set --global hydro_prefix_beginning \n" "
set --global hydro_prefix_git " "
set --global hydro_prefix_pwd " "
set --global hydro_prefix_duration "󰅐 "

Expecting something like this: Screenshot_20240123_235336

Beginning, pwd and duration seems to work as expected, git branch prefix pasted manually just for screenshot. Beginning can also be colored with new variable: hydro_color_beginning

XelorR commented 7 months ago

Now it seems to work as expected, created the pr: #52

oliver-cfc commented 4 months ago

Now it seems to work as expected, created the pr: #52

Just want to say I've been using this for a short while now and it's working perfectly as far as I can tell (just hydro_color_beginning and hydro_prefix_beginning)

jorgebucaran commented 4 months ago

Good to know! Thanks 👍