feat(starship): speedup jj prompt

This commit is contained in:
2025-07-24 21:48:13 +08:00
parent 94764e7a5a
commit a0b044dbc9

View File

@@ -44,11 +44,11 @@ lib.my.makeSwitch {
jj = { jj = {
ignore_timeout = true; ignore_timeout = true;
description = "The current jj status"; description = "The current jj status";
when = "jj root"; when = true;
symbol = " ";
command = '' command = ''
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
separate(" ", separate(" ",
" ",
change_id.shortest(4), change_id.shortest(4),
bookmarks, bookmarks,
"|", "|",
@@ -64,19 +64,9 @@ lib.my.makeSwitch {
"(no description set)", "(no description set)",
) ++ raw_escape_sequence("\x1b[0m"), ) ++ raw_escape_sequence("\x1b[0m"),
) )
' ' || (starship module git_branch && starship module git_status)
''; '';
}; };
git_branch = {
when = true;
command = "jj root >/dev/null 2>&1 || starship module git_branch";
description = "Only show git_branch if we're not in a jj repo";
};
git_status = {
when = true;
command = "jj root >/dev/null 2>&1 || starship module git_status";
description = "Only show git_status if we're not in a jj repo";
};
}; };
git_state.disabled = true; git_state.disabled = true;
git_commit.disabled = true; git_commit.disabled = true;