diff options
author | Soispha <soispha@vhack.eu> | 2023-12-29 19:27:38 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-12-29 20:41:13 +0100 |
commit | f1641ed52fd89aed7e91508bda7a644514d2ab70 (patch) | |
tree | 08838b623047e2aa25a991d748795109494419ef | |
parent | fix(hm/conf/starship): Correctly escape strings (diff) | |
download | nixos-config-f1641ed52fd89aed7e91508bda7a644514d2ab70.tar.gz nixos-config-f1641ed52fd89aed7e91508bda7a644514d2ab70.zip |
fix(hm/conf/starship): Try to change path colour based on exit
-rw-r--r-- | hm/soispha/conf/starship/default.nix | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/hm/soispha/conf/starship/default.nix b/hm/soispha/conf/starship/default.nix index ba531c83..827c2a93 100644 --- a/hm/soispha/conf/starship/default.nix +++ b/hm/soispha/conf/starship/default.nix @@ -1,6 +1,7 @@ { lib, nixosConfig, + pkgs, ... }: { programs.starship = { @@ -9,7 +10,7 @@ settings = { add_newline = false; format = lib.concatStrings [ - "$directory" + "\${custom.status_output}$directory\${custom.status_clear}" "$username" "$cmd_duration" "$status" @@ -17,12 +18,12 @@ ]; right_format = lib.concatStrings ( [ - "$time" "$git_metrics" "$git_branch" "$git_status" "$git_commit" "$git_state" + "$time" ] ++ lib.optional nixosConfig.soispha.laptop.enable @@ -37,7 +38,7 @@ }; status = { disabled = false; - format = "[($common_meaning \\($status\\))($signal_name \\($signal_number\\)))]($style)"; + format = "([($common_meaning \\($status\\))($signal_name \\($signal_number\\))]($style) )"; }; time = { disabled = false; @@ -47,6 +48,8 @@ format = "as [$user]($style) "; }; git_status = { + disabled = true; + format = "([\\[$ahead_behind\\]]($style) )"; ahead = "⇡$count"; diverged = "⇕⇡$ahead_count⇣$behind_count"; behind = "⇣$count"; @@ -55,21 +58,45 @@ disabled = false; ignore_submodules = true; }; - git_state = {}; + git_state = { + format = "[\($state( $progress_current of $progress_total)\)]($style) "; + rebase = "[rebasing](bold magenta)"; + merge = "[merging](bold yellow)"; + revert = "[reverting](bold blue)"; + cherry_pick = "[picking](bold red)"; + bisect = "[bisecting](bold red)"; + am = "[applying](bold green)"; + am_or_rebase = "[applying/rebasing](bold yellow)"; + }; git_commit = { tag_disabled = false; tag_symbol = "v"; - format = "[(\\[($hash$tag\\])]($style)"; + format = "[(\\[$hash$tag\\] )]($style) "; }; directory = { truncate_to_repo = true; read_only = ""; before_repo_root_style = "black bold dimmed"; + format = + "[$before_root_path]($before_repo_root_style)[$repo_root]($repo_root_style)$path[$read_only]($read_only_style)"; }; cmd_duration = { min_time = 2000; # Milliseconds style = "bold white"; }; + custom = { + status_output = { + format = "$output"; + command = "if test $STARSHIP_CMD_STATUS -ne 0; then echo \"\\033[31;1m\"; else echo \"\\033[34;1m\"; fi"; + shell = [ "${pkgs.dash}" ]; + }; + status_clear = { + when = "test $STARSHIP_CMD_STATUS -ne 0"; + format = "$output"; + command = "echo \"\\033[m\""; + shell = [ "${pkgs.dash}" ]; + }; + }; battery = { # ' ' # ' ' |