home · login to get plonkin'

my jj nix config

@oppi.li · 16d ago · plaintext · 136 loc · raw · 0 comments

1  programs.jujutsu = {2    enable = true;3    settings = {4      user = {5        name = "oppiliappan";6        email = "me@oppi.li";7      };8      ui = {9        # paginate = "never";10        default-command = "status";11        pager = "${pkgs.delta}/bin/delta";12        diff.format = "git";13        graph.style = "curved";14      };15      colors = {16        commit_id = "magenta";17        change_id = "cyan";18        "working_copy empty" = "green";19        "working_copy placeholder" = "red";20        "working_copy description placeholder" = "yellow";21        "working_copy empty description placeholder" = "green";22        prefix = {23          bold = true;24          fg = "cyan";25        };26        rest = {27          bold = false;28          fg = "bright black";29        };30        "node elided" = "yellow";31        "node working_copy" = "green";32        "node conflict" = "red";33        "node immutable" = "red";34        "node normal" = { bold = false; };35        "node" = { bold = false; };36      };37      git = {38        write-change-id-header = true;39        subprocess = true;40      };41      aliases = {42        d = ["diff"];43        l = ["log"];44        ll = ["log" "-r" ".."];45        tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];46      };47      revsets = {48        log = "current_work";49      };50      revset-aliases = {51        "stack()" = "ancestors(reachable(@, mutable()), 2)";52        "stack(x)" = "ancestors(reachable(x, mutable()), 2)";53        "stack(x, n)" = "ancestors(reachable(x, mutable()), n)";54        "current_work" = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)";55      };56      template-aliases = {57        "format_short_id(id)" = "id.shortest()";58        "abbreviate_timestamp_suffix(s, suffix, abbr)" = ''59            if(60                s.ends_with(suffix),61                s.remove_suffix(suffix) ++ label("timestamp", abbr)62            )63        '';64        "abbreviate_relative_timestamp(s)" = ''65            coalesce(66                abbreviate_timestamp_suffix(s, " millisecond", "ms"),67                abbreviate_timestamp_suffix(s, " second", "s"),68                abbreviate_timestamp_suffix(s, " minute", "m"),69                abbreviate_timestamp_suffix(s, " hour", "h"),70                abbreviate_timestamp_suffix(s, " day", "d"),71                abbreviate_timestamp_suffix(s, " week", "w"),72                abbreviate_timestamp_suffix(s, " month", "mo"),73                abbreviate_timestamp_suffix(s, " year", "y"),74                s75            )76        '';77        "format_timestamp(timestamp)" = ''78          coalesce(79              if(timestamp.after("1 minute ago"), label("timestamp", "<=1m")),80              abbreviate_relative_timestamp(timestamp.ago().remove_suffix(' ago').remove_suffix('s'))81          )82        '';83      };84      templates = {85        log = ''86          if(root,87            format_root_commit(self),88            label(if(current_working_copy, "working_copy"),89              concat(90                separate(" ",91                  pad_end(4, format_short_change_id_with_hidden_and_divergent_info(self)),92                  if(empty, label("empty", "(empty)")),93                  if(description,94                    description.first_line(),95                    label(if(empty, "empty"), description_placeholder),96                  ),97                  bookmarks,98                  tags,99                  working_copies,100                  if(git_head, label("git_head", "HEAD")),101                  if(conflict, label("conflict", "conflict")),102                  if(config("ui.show-cryptographic-signatures").as_boolean(),103                    format_short_cryptographic_signature(signature)),104                  format_timestamp(commit_timestamp(self)),105                ) ++ "\n",106              ),107            )108          )109        '';110        log_node = ''111          label("node",112            coalesce(113              if(!self, label("elided", "~")),114              if(current_working_copy, label("working_copy", "@")),115              if(conflict, label("conflict", "×")),116117              if(immutable, label("immutable", "*")),118              label("normal", "·")119            )120          )121        '';122        draft_commit_description = ''123          concat(124            coalesce(description, default_commit_description, "\n"),125            surround(126              "\nJJ: This commit contains the following changes:\n", "",127              indent("JJ:     ", diff.stat(72)),128            ),129            "\nJJ: ignore-rest\n",130            diff.git(),131          )132        '';133      };134    };135  };136

login to post a comment