summaryrefslogtreecommitdiff
path: root/jj.nix
blob: 744249caf151cdb5b2378842bf619839054d23f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
  pkgs,
  inputs,
  config,
  ...
}: let
  tomlFormat = pkgs.formats.toml {};
in {
  xdg.configFile."jj/config.toml".source = tomlFormat.generate "config.toml" {
    user = {
      name = config.my.git.name;
      email = config.my.git.email;
    };
    ui = {
      diff-formatter = ":git";
      pager = ":builtin";
    };
    aliases = {
      wk = ["log" "-r" "trunk()::@ | @::"];
      gp = ["git" "push" "--allow-new"];
      gf = ["git" "fetch"];
      tracked = ["bookmark" "list" "-t" "-T" ''if(self.tracked(), if(self.name() != "main", self.name()++"\n"))''];
      untracked = ["bookmark" "list" "-T" ''if(!self.tracked(), if(self.name() != "main", self.name()++"\n"))''];
      e = ["edit"];
      track = ["util" "exec" "--" "bash" "-c" "jj bookmark set $(jj log -r @ -T 'self.change_id()' --no-graph)"];
      tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
      nm = ["new" "-r" "trunk()"];
    };
    templates = {
      log = "builtin_log_compact";
    };
    template-aliases = {
      "commit_timestamp(commit)" = "commit.author().timestamp()";
    };
  };
}