diff options
| author | Christoph Schlosser <christoph@linux.com> | 2025-06-19 23:50:39 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christoph@linux.com> | 2025-06-20 00:16:50 +0200 |
| commit | ed06188a2f53232d5158438e5692776753ffbdcd (patch) | |
| tree | 975a55ff701a6b0df41836805a89345c6c5c70d8 /conf.d | |
| parent | 561f30f8aba1be47b53b8eb5fafca0bac4b960df (diff) | |
| download | c-star-ed06188a2f53232d5158438e5692776753ffbdcd.tar.gz | |
Minimize how often variables are updated
This comes at the expense of color changes not being redrawn
immediately. Changing the color style isn't my primary way of
interacting with a shell so it's a tradeoff I'm willing to make.
Diffstat (limited to 'conf.d')
| -rw-r--r-- | conf.d/cstar.fish | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/conf.d/cstar.fish b/conf.d/cstar.fish index 3f4586b..ed77943 100644 --- a/conf.d/cstar.fish +++ b/conf.d/cstar.fish @@ -1,3 +1,5 @@ +status is-interactive || exit + set -q cstar_date_format || set -g cstar_date_format "%Y-%m-%dT%H:%M:%S%z" set -g cstar_default_bg 333333 set -g cstar_default_fg a9b7c6 @@ -29,7 +31,7 @@ function cstar_command_time --on-event fish_postexec cstar_colorize cstar_command_time $CMD_DURATION'ms' $cstar_command_time_bg $cstar_command_time_fg end -function cstar_datetime --on-event fish_prompt --on-event fish_postexec +function cstar_datetime --on-event fish_prompt cstar_colorize cstar_datetime (date "+$cstar_date_format") $cstar_datetime_bg $cstar_datetime_fg end @@ -74,7 +76,7 @@ function cstar_git --on-variable $_cstar_git_async commandline --function repaint end -function cstar_user --on-event fish_prompt +function cstar_user --on-variable __fish_initialized set -l user_string (whoami) if test -n "$SSH_CONNECTION" set -f user_string "$user_string@$(hostname)" @@ -82,7 +84,7 @@ function cstar_user --on-event fish_prompt cstar_colorize cstar_user "$user_string" $cstar_user_bg $cstar_user_fg end -function cstar_user_marker --on-event fish_prompt +function cstar_user_marker --on-variable __fish_initialized switch (whoami) case "root" set -g cstar_user_marker_bg red @@ -94,7 +96,7 @@ function cstar_user_marker --on-event fish_prompt cstar_colorize cstar_user_marker $char $cstar_user_marker_bg $cstar_user_marker_fg end -function cstar_pwd --on-variable PWD --on-event fish_prompt +function cstar_pwd --on-variable PWD --on-variable __fish_initialized cstar_colorize cstar_pwd (prompt_pwd) $cstar_pwd_bg $cstar_pwd_fg end |