starship/starship
Right and continuation prompts
Two render targets that complement the standard left prompt: the right prompt (printed flush-right on the same line as the input) and the continuation prompt (printed when the shell needs more input on a multi-line command).
Right prompt
right_format = "[$cmd_duration]($style)"Rendered when the shell calls starship prompt --right. Configuration:
right_formatonStarshipRootConfig— the format string.- The render target is
Target::Right. - After rendering, all newlines are stripped (
buf = buf.replace('\n', "")inprint::get_prompt).
Shell-specific wiring
| Shell | How |
|---|---|
| Bash | Bash has no native right prompt. Starship's bash init computes the rendered string into a variable but does not print it; users wire it up with their own escape sequences. |
| Zsh | Sets RPROMPT="$(starship prompt --right ...)". |
| Fish | Defines fish_right_prompt that calls starship prompt --right .... |
| PowerShell | Custom logic that uses $PSStyle and cursor positioning to print the right prompt then return the cursor. |
| Nushell | Sets PROMPT_COMMAND_RIGHT. |
Less mainstream shells (ion, elvish, tcsh) typically don't expose a right prompt; the init scripts skip it.
Continuation prompt
continuation_prompt = "[∙](bright-black) "Rendered when the shell calls starship prompt --continuation. The default is [∙](bright-black) , defined on StarshipRootConfig. The render target is Target::Continuation.
Shell support
| Shell | How |
|---|---|
| Bash | PS2="$(starship prompt --continuation)". |
| Zsh | PROMPT2="$(starship prompt --continuation)". |
| Fish | Defines fish_prompt_continuation (relatively new feature in fish). |
| PowerShell | Heuristic detection from the previous line ending (backtick or open brace). |
Each init script in src/init/starship.<shell> shows the exact wiring.
Behavior differences
Target::Continuation takes a different path through load_formatter_and_modules:
if context.target == Target::Continuation {
let formatter = StringFormatter::new(&config.continuation_prompt);
// ...
}It does not descend into format or right_format, and does not run modules unless they are explicitly referenced in continuation_prompt. The default [∙](bright-black) has no modules, so the continuation prompt is essentially zero-cost.
If the format string is unparseable, the renderer falls back to > (literal) instead of erroring out — same as for other targets.
Newline behavior
| Target | Newline rule |
|---|---|
Main |
Adds a leading newline if add_newline = true (default). |
Right |
Strips all newlines after rendering. |
Continuation |
Skips the leading newline (it would break the shell's continuation). |
Profile(_) |
Adds a leading newline if add_newline = true (same as Main). |
The logic is in get_prompt:
if config.add_newline && context.target != Target::Continuation {
writeln!(buf).unwrap();
}Practical examples
A two-line prompt with a right-side timer:
add_newline = true
format = """
$directory$git_branch$git_status
$character"""
right_format = "[$cmd_duration]($style)"
continuation_prompt = "[∙](bright-black) "
[cmd_duration]
min_time = 200A minimal right prompt that disappears under load:
[cmd_duration]
disabled = falseSee also
- Prompt rendering — full pipeline.
- Init scripts — per-shell continuation/right wiring.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.