feat(zsh): starship prompt

This commit is contained in:
2025-07-11 14:52:46 +08:00
parent 2177549100
commit be4de25d84
2 changed files with 234 additions and 0 deletions

View File

@@ -36,6 +36,50 @@ lib.my.makeSwitch {
fzf
zoxide
];
programs.starship = {
enable = true;
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
add_newline = false;
custom = {
jj = {
ignore_timeout = true;
description = "The current jj status";
detect_folders = [ ".jj" ];
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"),
)
'
'';
};
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_state.disabled = true;
git_commit.disabled = true;
git_metrics.disabled = true;
git_branch.disabled = true;
nix_shell.disabled = true;
};
};
programs.zsh = {
enable = true;
dotDir = ".config/zsh";