Starship config

Starship is an all singing, all dancing framework for customising your shell prompt

Config

Tell editors that support completions in TOML files where to find the schema.

starship.toml
default r1
"$schema" = 'https://starship.rs/config-schema.json'

Ensure that there’s a blank link between prompts.

starship.toml
default r1
add_newline = true

Jujutsu

The following was pieced together using examples from the jj wiki

starship.toml
default r1
[custom.jj]
ignore_timeout = true
description = "The current jj status"
when = "jj root --ignore-working-copy"
symbol = "jj "
command = '''
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
  separate(" ",
    change_id.shortest(8),
    bookmarks,
    "|",
    concat(
      if(conflict, "✘"),
      if(divergent, ""),
      if(hidden, ""),
      if(immutable, "◆"),
    ),
    raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)") ++ raw_escape_sequence("\x1b[0m"),
    raw_escape_sequence("\x1b[1;32m") ++ coalesce(
      truncate_end(29, description.first_line(), "…"),
      "(no description set)",
    ) ++ raw_escape_sequence("\x1b[0m"),
  )
'
'''

Of course, if we have git and jj co-located, we only want one to show

starship.toml
default r1
[git_state]
disabled = true

[git_commit]
disabled = true

[git_metrics]
disabled = true

[git_branch]
disabled = true

[custom.git_branch]
when = true
command = "jj root --ignore-working-copy >/dev/null 2>&1 || starship module git_branch"