Prompts2026年4月11日·1 分钟阅读

Starship — Minimal Blazing-Fast Customizable Shell Prompt

Starship is a minimal, blazing-fast, and infinitely customizable prompt for any shell. Works with bash, zsh, fish, PowerShell, nushell, and more. Single TOML config file and Rust-powered speed with gorgeous defaults.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 62/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Prompt
安装
Single
信任
信任等级:Established
入口
step-1.md
先审查命令
npx -y tokrepo@latest install 85b6c0d9-35bd-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
Starship is a Rust-powered cross-shell prompt that shows git status, language versions, and cloud context with zero latency.
§01

What it is

Starship is a minimal, fast, and customizable prompt for any shell. Written in Rust, it renders contextual information like git status, language versions, Kubernetes context, and cloud profiles without measurable latency. Configuration lives in a single TOML file.

Starship works with bash, zsh, fish, PowerShell, nushell, cmd, xonsh, ion, elvish, and more. It targets developers who spend significant time in the terminal and want context-rich prompts without slowdowns.

§02

How it saves time or tokens

Starship eliminates manual checks for project context. Instead of running git status, node --version, or kubectl config current-context separately, the prompt shows all of this inline. It detects package managers, Docker contexts, and cloud profiles automatically. The Rust implementation keeps rendering under 1ms even with many modules enabled.

§03

How to use

  1. Install Starship via Homebrew, curl, or scoop.
  2. Add the init script to your shell configuration file.
  3. Customize ~/.config/starship.toml to enable or disable modules.
# Install
brew install starship

# Add to ~/.zshrc
eval "$(starship init zsh)"

# Add to ~/.bashrc
eval "$(starship init bash)"
§04

Example

A custom Starship configuration showing git branch, Node.js version, and directory info:

add_newline = true

[character]
success_symbol = '[>](bold green)'
error_symbol = '[x](bold red)'

[directory]
truncation_length = 3
truncate_to_repo = true

[git_branch]
symbol = 'branch '

[nodejs]
format = 'via [node $version](bold green) '

[kubernetes]
disabled = false
format = 'on [k8s $context](blue) '

This produces a prompt like: ~/projects/my-app branch main via node v20.11 on k8s prod >

§05

Related on TokRepo

§06

Common pitfalls

  • Nerd Fonts are required for icons. Without them, the prompt shows garbled characters. Install a patched font from nerdfonts.com.
  • Enabling too many modules slows the prompt on older machines. Disable modules you do not need in starship.toml.
  • Fish shell users must use starship init fish | source syntax, not eval. The init command differs per shell.

常见问题

Which shells does Starship support?+

Starship supports bash, zsh, fish, PowerShell, nushell, cmd, xonsh, ion, elvish, and tcsh. Each shell has its own init command. The configuration file is shared across all shells, so switching shells does not require reconfiguration.

Does Starship slow down my terminal?+

No. Starship is written in Rust and renders in under 1ms for most configurations. It only runs the detection logic for modules that are enabled and relevant to the current directory. Disabling unused modules makes it even faster.

How do I customize what Starship shows?+

Edit the file at ~/.config/starship.toml. Each module (git, node, python, kubernetes, etc.) has its own configuration section where you can set format strings, symbols, colors, and enable/disable the module entirely.

Can I use Starship with VS Code terminal?+

Yes. Starship works in any terminal emulator including the VS Code integrated terminal. Set your VS Code terminal to use a Nerd Font for proper icon rendering, and ensure the shell init script is in your shell config file.

What information does Starship show by default?+

Out of the box, Starship shows the current directory, git branch and status, detected language versions (Node, Python, Rust, Go, etc.), command duration for slow commands, and error indicators. The defaults are designed to be useful without configuration.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产