fish-shell/share/functions/fish_jj_prompt.fish
Johannes Altmanninger 0debddc9e5 Add a simple fish_jj_prompt
jj is often colocated with Git so the Git prompt also works, but
jj is always in a detached HEAD state, which is atypical for Git.
The jj prompt improves things by showing the revision ID which is
usually more useful than the commit ID.

This prompt is mostly adapted from the defaults for "jj log -r @".

Showing conflicting/empty commits seems useful.
Also perhaps bookmarks and tags, not sure.

The main problem with this prompt is that due to --ignore-working-copy,
the information may be stale.  That will be rectified after every jj
command, so hopefully this doesn't cause issues.
2025-01-03 00:03:58 +01:00

14 lines
495 B
Fish
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function fish_jj_prompt
jj log 2>/dev/null --no-graph --ignore-working-copy --color=always --revisions @ \
--template '
concat(
" ",
separate(" ",
format_short_change_id_with_hidden_and_divergent_info(self),
bookmarks,
tags,
if(conflict, label("conflict", "×")),
if(empty, label("empty", "(empty)"))
),
)'
end