diff --git a/content/config/nushell/scripts/ide.nu b/content/config/nushell/scripts/ide.nu index f931090..a2d6875 100755 --- a/content/config/nushell/scripts/ide.nu +++ b/content/config/nushell/scripts/ide.nu @@ -145,7 +145,7 @@ export def `zjstatus powerline_left` [] { fg: "#ffffff" } { - text: $"(git rev-parse --abbrev-ref HEAD) " + text: $"(branch-name) " icon: "" bg: "blue" fg: $ZELLIJ_BG @@ -154,12 +154,23 @@ export def `zjstatus powerline_left` [] { render powerline $ZELLIJ_BG $elements --start "" } +def branch-name [] { + let name = (git rev-parse --abbrev-ref HEAD) + let parts = ($name | split row "/") + + if ($parts | length) > 1 { + $"(ansi {attr: i})($parts.0)/(ansi reset)(ansi {fg: $ZELLIJ_BG, bg: blue, attr: b})($parts | skip 1 | str join '/')" + } else { + $"(ansi {attr: b})($name)" + } +} + export def `zjstatus powerline_right` [] { use ci.nu let sys = (sys) let elements = ([ - (ci status) + (try { ci status } catch { null }) { text: ($sys.cpu.cpu_usage | math avg | math round -p 2 | $"($in) % " | fill -a right -c ' ' -w 8) icon: ""