starship: add jj
This commit is contained in:
@@ -3,3 +3,72 @@
|
||||
|
||||
# Inserts a blank line between shell prompts
|
||||
add_newline = false
|
||||
|
||||
[custom.jj]
|
||||
description = "The current jj status"
|
||||
when = "jj --ignore-working-copy root"
|
||||
symbol = "🥋 "
|
||||
command = '''
|
||||
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
|
||||
separate(" ",
|
||||
change_id.shortest(4),
|
||||
bookmarks,
|
||||
"|",
|
||||
concat(
|
||||
if(conflict, "💥"),
|
||||
if(divergent, "🚧"),
|
||||
if(hidden, "👻"),
|
||||
if(immutable, "🔒"),
|
||||
),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
|
||||
truncate_end(29, description.first_line(), "…"),
|
||||
"(no description set)",
|
||||
) ++ raw_escape_sequence("\x1b[0m"),
|
||||
)
|
||||
'
|
||||
'''
|
||||
|
||||
# optionally disable git modules when JJ is found.
|
||||
# note that you'll need to add ${custom.git_branch}, ${custom.git_commit} etc
|
||||
# into format: https://starship.rs/config/#default-prompt-format
|
||||
[git_status]
|
||||
disabled = true
|
||||
|
||||
[custom.git_status]
|
||||
when = "! jj --ignore-working-copy root" # Slow without `require_repo = true`
|
||||
require_repo = true # Avoids `when` eval overhead in plain dirs
|
||||
command = "starship module git_status"
|
||||
style = "" # This disables the default "(bold green)" style
|
||||
description = "Only show git_status if we're not in a jj repo"
|
||||
|
||||
[git_commit]
|
||||
disabled = true
|
||||
|
||||
[custom.git_commit]
|
||||
when = "! jj --ignore-working-copy root"
|
||||
require_repo = true
|
||||
command = "starship module git_commit"
|
||||
style = ""
|
||||
description = "Only show git_commit if we're not in a jj repo"
|
||||
|
||||
|
||||
[git_metrics]
|
||||
disabled = true
|
||||
|
||||
[custom.git_metrics]
|
||||
when = "! jj --ignore-working-copy root"
|
||||
require_repo = true
|
||||
command = "starship module git_metrics"
|
||||
description = "Only show git_metrics if we're not in a jj repo"
|
||||
style = ""
|
||||
|
||||
[git_branch]
|
||||
disabled = true
|
||||
|
||||
[custom.git_branch]
|
||||
when = "! jj --ignore-working-copy root"
|
||||
require_repo = true
|
||||
command = "starship module git_branch"
|
||||
description = "Only show git_branch if we're not in a jj repo"
|
||||
style = ""
|
||||
|
||||
Reference in New Issue
Block a user