Unified Starship prompt module for Git and Jujutsu repositories that is optimized for latency.
brew install dmmulroy/tap/jj-starshipcargo install jj-starshipgit clone https://github.com/dmmulroy/jj-starship
cd jj-starship
cargo install --path .# Try it
nix run github:dmmulroy/jj-starship
# Install to profile
nix profile install github:dmmulroy/jj-starship
# Minimal build (no git support, smaller closure)
nix run github:dmmulroy/jj-starship#jj-starship-no-gitOr add to your flake inputs:
{
inputs.jj-starship.url = "github:dmmulroy/jj-starship";
outputs = { self, nixpkgs, jj-starship, ... }: {
# Use the overlay
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [{
nixpkgs.overlays = [ jj-starship.overlays.default ];
environment.systemPackages = [ pkgs.jj-starship ];
}];
};
};
}The git feature is enabled by default. Disable to compile out the git backend:
# JJ only (excludes git2 dependency)
cargo install --no-default-features jj-starshipAdd to ~/.config/starship.toml:
[custom.jj]
command = "jj-starship"
detect_folders = [".jj", ".git"]
shell = ["sh"]
format = "$output "Why these settings:
detect_folders- Starship checks directory existence natively (no process spawn), only runs command in reposshell = ["sh"]- Uses minimal POSIX shell, bypasses user's shell rc files (~100ms faster)format = "$output "- Passes through jj-starship's ANSI colors directly
For JJ repos only (keep native git modules for pure git repos):
detect_folders = [".jj"]To hide built-in modules when in a JJ repo:
[git_branch]
disabled = true
[git_status]
disabled = trueon {symbol}{change_id} ({bookmarks}) [{status}]
{change_id}- Short change ID (hide with--no-jj-id){bookmarks}- Comma-separated bookmarks with distance, sorted by proximity (hide with--no-jj-name)- Distance 0 (bookmark on WC):
main - Ancestor bookmark:
main~3(3 commits behind)
- Distance 0 (bookmark on WC):
{status}- Sync status based on first/closest bookmark only
Examples:
on yzxv1234 [?]- No bookmarkson yzxv1234 (main) [?]- On bookmarkmainon yzxv1234 (main~3) [?]- 3 commits ahead ofmainon yzxv1234 (pr-3, pr-2~1, main~5)- Direct + ancestor bookmarks
on {symbol}{branch} ({commit}) [{status}]
| Symbol | Meaning |
|---|---|
! |
Conflict |
? |
Empty description |
⇔ |
Divergent |
⇡ |
Current or closest bookmark unsynced with remote |
| Symbol | Meaning |
|---|---|
= |
Conflicted |
+ |
Staged |
! |
Modified |
? |
Untracked |
✘ |
Deleted |
⇡n |
Ahead by n |
⇣n |
Behind by n |
| Option | Description |
|---|---|
--cwd <PATH> |
Override working directory |
--truncate-name <N> |
Max branch/bookmark name length (0 = unlimited) |
--id-length <N> |
Hash display length (default: 8) |
--ancestor-bookmark-depth <N> |
Max depth to search for ancestor bookmarks (default: 10, 0 = disabled) |
--jj-symbol <S> |
JJ repo symbol (default: ) |
--git-symbol <S> |
Git repo symbol (default: ) |
--no-color |
Disable output styling |
--no-symbol |
Disable symbol prefix |
--no-jj-prefix |
Hide "on {symbol}" for JJ |
--no-jj-name |
Hide bookmark name |
--no-jj-id |
Hide change ID |
--no-jj-status |
Hide JJ status |
--no-git-prefix |
Hide "on {symbol}" for Git |
--no-git-name |
Hide branch name |
--no-git-id |
Hide commit hash |
--no-git-status |
Hide Git status |
All options can be set via environment variables (CLI args take precedence):
JJ_STARSHIP_TRUNCATE_NAMEJJ_STARSHIP_ID_LENGTHJJ_STARSHIP_ANCESTOR_BOOKMARK_DEPTHJJ_STARSHIP_JJ_SYMBOLJJ_STARSHIP_GIT_SYMBOLJJ_STARSHIP_NO_JJ_PREFIXJJ_STARSHIP_NO_JJ_COLORJJ_STARSHIP_NO_JJ_NAMEJJ_STARSHIP_NO_JJ_IDJJ_STARSHIP_NO_JJ_STATUSJJ_STARSHIP_NO_GIT_PREFIXJJ_STARSHIP_NO_GIT_COLORJJ_STARSHIP_NO_GIT_NAMEJJ_STARSHIP_NO_GIT_IDJJ_STARSHIP_NO_GIT_STATUS
Example configuration in a powerline prompt, for instance Gruvbox Rainbow:
format = """
[](color_orange)\
$os\
$username\
[](bg:color_yellow fg:color_orange)\
$directory\
[](fg:color_yellow bg:color_aqua)\
${custom.jj}\ # <- replace $git_branch $git_status here
[](fg:color_aqua bg:color_blue)\
...
"""
[git_branch]
disabled = true
[git_status]
disabled = true
[custom.jj]
symbol = ""
style = "bg:color_aqua"
format = '[[ $symbol $output ](fg:color_fg0 bg:color_aqua)]($style)'
command = "jj-starship --no-color --no-symbol --no-jj-prefix --no-git-prefix"
detect_folders = [".jj", ".git"]
shell = ["sh"]MIT