Skip to content
Laust Rud Jacobsen edited this page Sep 17, 2024 · 4 revisions

https://starship.rs/ is a cross-shell prompt.

For some info about the jj change you are currently at you can use:

[custom.jj]
command = '''
jj log -r@ -l1 --ignore-working-copy --no-graph --color always  -T '
  separate(" ",
    branches.map(|x| if(
        x.name().substr(0, 10).starts_with(x.name()),
        x.name().substr(0, 10),
        x.name().substr(0, 9) ++ "…")
      ).join(" "),
    tags.map(|x| if(
        x.name().substr(0, 10).starts_with(x.name()),
        x.name().substr(0, 10),
        x.name().substr(0, 9) ++ "…")
      ).join(" "),
    surround("\"","\"",
      if(
         description.first_line().substr(0, 24).starts_with(description.first_line()),
         description.first_line().substr(0, 24),
         description.first_line().substr(0, 23) ++ "…"
      )
    ),
    if(conflict, "conflict"),
    if(divergent, "divergent"),
    if(hidden, "hidden"),
  )
'
'''
detect_folders = [".jj"]
symbol = "jj"

[custom.jjstate]
detect_folders = [".jj"]
command = '''
jj log -r@ -n1 --no-graph -T "" --stat | tail -n1 | sd "(\d+) files? changed, (\d+) insertions?\(\+\), (\d+) deletions?\(-\)" ' ${1}m ${2}+ ${3}-' | sd " 0." ""
'''

This is partially inspired by the Fish Shell prompt example.

This is a quick solution, feel free to improve on it and share your improvements.

Clone this wiki locally