summaryrefslogtreecommitdiff
path: root/fish/functions/fish_jj_prompt.fish
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2025-07-27 19:48:46 +0100
committertslil <tslil@posteo.de>2025-07-27 19:53:18 +0100
commit091b183b836a332b4b9efc6ecb8939d6a4455dca (patch)
treee6fb1dfec0cfb7fd5bd296a81b50970373c275c2 /fish/functions/fish_jj_prompt.fish
parentea924ebfcfab4c612dd91fa90a4022929272fe11 (diff)
[fish] improve jj prompt
Diffstat (limited to 'fish/functions/fish_jj_prompt.fish')
-rw-r--r--fish/functions/fish_jj_prompt.fish43
1 files changed, 21 insertions, 22 deletions
diff --git a/fish/functions/fish_jj_prompt.fish b/fish/functions/fish_jj_prompt.fish
index 7ab024e..b2fb5ba 100644
--- a/fish/functions/fish_jj_prompt.fish
+++ b/fish/functions/fish_jj_prompt.fish
@@ -7,33 +7,32 @@ function fish_jj_prompt --description 'Write out the jj prompt'
return 1
end
- jj log --ignore-working-copy --no-graph --color always -r @ -T '
+ set parent_bmarks (jj log --no-graph -r 'bookmarks() & parents(@)' -T 'bookmarks.join(", ")')
+
+ set template "
surround(
- " (",
- ")",
+ ' (',
+ ')',
separate(
- " ",
- bookmarks.join(", "),
- if(empty, "∅"),
+ ' ',
+ if(empty, '∅', '● ' ++ self.diff().files().len()),
coalesce(
surround(
- "\"",
- "\"",
- if(
- description.first_line().substr(0, 12).starts_with(description.first_line()),
- description.first_line().substr(0, 12),
- description.first_line().substr(0, 11) ++ "…"
- )
+ '\"',
+ '\"',
+ truncate_end(12, description.first_line(), '…')
),
- label("description placeholder", "?")
+ label('description placeholder', '?')
+ ),
+ change_id.shortest() ++ surround(
+ '<', '>',
+ bookmarks.join(', ')
),
- "|",
- change_id.shortest(),
- commit_id.shortest(),
- if(conflict, "X"),
- if(divergent, "☇"),
- if(hidden, "⬚"),
+ surround('~<', '>', \"$parent_bmarks\"),
+ if(conflict, 'X'),
+ if(divergent, '☇'),
+ if(hidden, '⬚'),
)
- )
- ' 2>/dev/null
+ )"
+ jj log --no-graph --color always -r @ -T $template
end