summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2024-10-27 23:08:17 +0100
committerMinijackson <minijackson@riseup.net>2024-10-27 23:08:17 +0100
commita4eb3d531c79b4ad8ca6c9a0736ee9304c7bbae0 (patch)
treef79efa01553d27873461cbdb49abdeb4d5d09ea1 /common
parent943dd97f99e535d2aa90682848ab6c4909a849b4 (diff)
downloadnixos-config-reborn-a4eb3d531c79b4ad8ca6c9a0736ee9304c7bbae0.tar.gz
nixos-config-reborn-a4eb3d531c79b4ad8ca6c9a0736ee9304c7bbae0.zip
common/starship: add custom jj elements
Diffstat (limited to 'common')
-rw-r--r--common/commandline/starship.nix45
1 files changed, 44 insertions, 1 deletions
diff --git a/common/commandline/starship.nix b/common/commandline/starship.nix
index 5983d2e..a17f9e8 100644
--- a/common/commandline/starship.nix
+++ b/common/commandline/starship.nix
@@ -1,4 +1,8 @@
1inputs: {lib, ...}: { 1_inputs:
2{ lib, pkgs, ... }:
3{
4 users.extraUsers.minijackson.packages = [ pkgs.sd ];
5
2 home-manager.users.minijackson = { 6 home-manager.users.minijackson = {
3 programs.starship = { 7 programs.starship = {
4 enable = true; 8 enable = true;
@@ -18,6 +22,45 @@ inputs: {lib, ...}: {
18 nix_shell.style = "bold blue"; 22 nix_shell.style = "bold blue";
19 package.style = "bold green"; 23 package.style = "bold green";
20 rust.style = "bold dimmed yellow"; 24 rust.style = "bold dimmed yellow";
25
26 custom = {
27 jj = {
28 command = ''
29 jj log -r@ -l1 --ignore-working-copy --no-graph --color always -T '
30 separate(" ",
31 bookmarks.map(|x| if(
32 x.name().substr(0, 10).starts_with(x.name()),
33 x.name().substr(0, 10),
34 x.name().substr(0, 9) ++ "…")
35 ).join(" "),
36 tags.map(|x| if(
37 x.name().substr(0, 10).starts_with(x.name()),
38 x.name().substr(0, 10),
39 x.name().substr(0, 9) ++ "…")
40 ).join(" "),
41 surround("\"","\"",
42 if(
43 description.first_line().substr(0, 24).starts_with(description.first_line()),
44 description.first_line().substr(0, 24),
45 description.first_line().substr(0, 23) ++ "…"
46 )
47 ),
48 if(conflict, "conflict"),
49 if(divergent, "divergent"),
50 if(hidden, "hidden"),
51 )
52 '
53 '';
54 detect_folders = [ ".jj" ];
55 symbol = "jj ";
56 };
57 jjstate = {
58 command = ''
59 jj log -r@ -n1 --no-graph -T "" --stat | tail -n1 | sd "(\d+) files? changed, (\d+) insertions?\(\+\), (\d+) deletions?\(-\)" ' ''${1}m ''${2}+ ''${3}-' | sd " 0." ""
60 '';
61 detect_folders = [ ".jj" ];
62 };
63 };
21 } 64 }
22 65
23 (lib.importTOML ./starship-plain-text-symbols.toml) 66 (lib.importTOML ./starship-plain-text-symbols.toml)