content: [user]
  name = "Abin Simon"
  email = "mail@meain.io"
  
  [ui]
  default-command = "stack"
  pager = ["sh", "-c", "diff-so-fancy | less -RFX"]
  conflict-marker-style = "git"
  # editor = "emacsclient"
  diff-editor = ":builtin"
  diff-formatter = ":git"
  # log-synthetic-elided-nodes = true # NOTE: what is this?
  # graph.style = "square"
  
  [colors]
  "diff removed token" = { underline = false }
  "diff added token" = { underline = false }
  
  [revset-aliases]
  "stack(r)" = "r | ancestors(descendants(immutable_heads()..r), 2)"
  "mine" = "remote_bookmarks() & (mine() | committer('mail@meain.io') | bookmarks('main') | bookmarks('master'))"
  'closest_bookmark(to)' = 'heads(::to & bookmarks())'
  'user(x)' = 'author(x) | committer(x)'
  'unpushed(x)' = '::x & ~reachable(::x, remote_bookmarks())'
  
  [aliases]
  stack = ["log", "-r", "stack(@)"]
  mine = ["log", "-r", "mine"]
  l = ["log", "-r", "..", "--limit", "10"]
  llog = ["log", "-r", ".."] # https://maddie.wtf/posts/2025-07-21-jujutsu-for-busy-devs/entry/1#see-more-of-the-log
  lmain = ["log", "-r", "::main"] # https://maddie.wtf/posts/2025-07-21-jujutsu-for-busy-devs/entry/1#see-more-of-the-log
  # l = ["log", "-r", "ancestors(reachable(@, mutable()), 2)"]
  tug = ["bookmark", "move", "--from", "closest_bookmark(@)", "--to", "@"] # update the bookmark
  rebase-all = ["rebase", "-s", "all:roots(trunk()..mutable())", "-d", "trunk()"] # another option at https://github.com/jj-vcs/jj/discussions/4974
  blame = ["file", "annotate"]
  nm = ["new", "trunk()"]
  e = ["edit"]
  
  [templates]
  log = 'personal_log_oneline'
  git_push_bookmark = '"meain/" ++ change_id.short()'
  # Show revisions that will be pushed in with a special icon
  log_node = '''
  if(self && !current_working_copy && !immutable && !conflict && in_branch(self),
    "◇",
    builtin_log_node
  )
  '''
  
  draft_commit_description = '''
  concat(
    description,
    "\n",
    indent(
      "JJ: ",
      concat(
        "Author: " ++ format_detailed_signature(author) ++ "\n",
        "Committer: " ++ format_detailed_signature(committer)  ++ "\n",
        "\n",
        diff.stat(76),
        "\n",
        diff.git(),
      ),
    ),
  )
  '''
  
  [template-aliases]
  # https://martinvonz.github.io/jj/latest/config/#display-of-commit-and-change-ids
  'format_short_id(id)' = 'id.shortest(5)'
  'format_timestamp(timestamp)' = 'timestamp.ago()'
  # https://andre.arko.net/2025/09/28/stupid-jj-tricks/
  'in_branch(commit)' = 'commit.contained_in("immutable_heads()..bookmarks()")'
  
  # Refer to jj/cli/src/config/templates.toml
  personal_log_oneline = '''
  if(root,
    format_root_commit(self),
    label(if(current_working_copy, "working_copy"),
      concat(
        separate(" ",
          format_short_change_id_with_hidden_and_divergent_info(self),
          if(bookmarks, "[" ++ bookmarks ++ "]"),
          tags,
          working_copies,
          if(git_head, label("git_head", "HEAD")),
          if(conflict, label("conflict", "conflict")),
          if(empty, label("empty", "(empty)")),
          if(description,
            description.first_line(),
            label(if(empty, "empty"), description_placeholder),
          ),
        ) ++ "\n",
      ),
    )
  )
  '''
  
  [lazyjj]
  highlight-color = "#f1f1f1"
  
  [git]
  write-change-id-header = true
  auto-local-bookmark = false # automatically create local bookmarks for remote ones
  colocate = true
  
  # JJ tools (uses stdin and outputs to stdout)
  [fix.tools.gofmt]
  command = ["gofmt"]
  patterns = ["glob:'**/*.go'"]
  
  [fix.tools.goimports]
  command = ["goimports"]
  patterns = ["glob:'**/*.go'"]
  
  [fix.tools.prettier-javascript]
  command = ["prettier", "--stdin-filepath", "$path"]
  patterns = ["glob:'**/*.js'", "glob:'**/*.jsx'", "glob:'**/*.ts'", "glob:'**/*.tsx'"]
  
  # [fix.tools.prettier-json]
  # command = ["prettier", "--stdin-filepath", "$path"]
  # patterns = ["glob:'**/*.json'", "glob:'**/*.json5'"]
  
  # [fix.tools.prettier-yaml]
  # command = ["prettier", "--stdin-filepath", "$path"]
  # patterns = ["glob:'**/*.yaml'", "glob:'**/*.yml'"]
  
  [fix.tools.prettier-html]
  command = ["prettier", "--stdin-filepath", "$path"]
  patterns = ["glob:'**/*.html'", "glob:'**/*.htm'"]
  
  [fix.tools.prettier-css]
  command = ["prettier", "--stdin-filepath", "$path"]
  patterns = ["glob:'**/*.css'"]
  
  # [fix.tools.prettier-markdown]
  # command = ["prettier", "--stdin-filepath", "$path"]
  # patterns = ["glob:'**/*.md'", "glob:'**/*.markdown'"]
  
  [fix.tools.nixfmt]
  command = ["nixfmt", "-"]
  patterns = ["glob:'**/*.nix'"]