深夜提醒

现在是深夜,建议您注意休息,不要熬夜哦~

🏮 🏮 🏮

新年快乐

祝君万事如意心想事成!

share-image
中
ESC

From Oh My Zsh to Starship: My Terminal Prompt Migration Journey

English 阅读中文版

While tidying up my dev environment last weekend, I found myself staring at the terminal for a good while. That Oh My Zsh that had been with me for three years always took a couple of seconds to load whenever I entered a project directory. As someone who opens a terminal hundreds of times a day, those accumulated two-second delays were enough to make me re-examine my toolchain.

That was the moment I started looking into Starship.

Starship terminal in action

Why not Oh My Zsh?

Honestly, Oh My Zsh used to be a marvel.

280+ plugins and 150+ themes, ready out of the box; a single sh -c "$(curl -fsSL ...) could dress your terminal up in all sorts of finery. Back in the day I switched themes endlessly, trying agnoster, powerlevel10k, and robbyrussell in turn.

But after using it for a while, some problems surfaced:

  • Slow startup: Every new terminal has to load dozens of plugins, and git status detection is especially costly.
  • A black-box config: So much is wrapped up too neatly, and when you want to fine-tune something you don’t even know where to start.
  • Cross-platform discrepancies: A theme configured nicely on Mac often gets mangled on a Linux server.

Powerlevel10k is indeed much faster, but it’s still fundamentally spinning inside the Zsh framework. What actually made me decide to switch was debugging inside a Docker container one time, when I discovered that installing Oh My Zsh on Alpine Linux is nothing short of a disaster.

What is Starship?

Put simply, it’s a cross-shell prompt tool written in Rust.

The official site describes it precisely: “The minimal, blazing-fast, and infinitely customizable prompt for any shell.” Three keywords: lightweight, blazing-fast, and infinitely customizable.

The core difference lies in the architecture:

Feature Oh My Zsh Powerlevel10k Starship
Language Shell script Zsh script Rust
Startup time 200-500ms 50-100ms <10ms
Cross-shell ❌ Zsh only ❌ Zsh only ✅ 10+ shells
Configuration Plugin-based Theme-based Declarative TOML
Memory footprint Higher Medium Very low
Cloud sync ❌ ❌ Native support

Rust brings more than just speed. Starship turns prompt rendering into a proper “discipline”—every module is independently configurable, and what you show, how you show it, and under what conditions are entirely under your control.

Installation: simpler than you’d think

Installation takes just one line:

curl -sS https://starship.rs/install.sh | sh

Then add one init line to your shell config:

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

# ~/.bashrc
eval "$(starship init bash)"

# ~/.config/fish/config.fish
starship init fish | source

It supports the mainstream shells—Bash, Zsh, Fish, PowerShell, Nushell—and even lesser-known choices like Ion, Elvish, and Tcsh.

There’s only one prerequisite: you need to install a Nerd Font. Starship relies heavily on icon glyphs to display git status, language versions, and so on.

# macOS
brew tap homebrew/cask-fonts
brew install --cask font-jetbrains-mono-nerd-font

# Then enable this font in your terminal settings

Configuration: my best practices

Starship’s config is a single file, ~/.config/starship.toml, written in TOML syntax—far friendlier than JSON.

Here’s the setup I’ve settled into, balancing practicality and performance:

# Basic setup: show timestamp and newlines
format = """
[](#3B4252)\
$time\
[](fg:#3B4252 bg:#434C5E)\
$directory\
[](fg:#434C5E bg:#4C566A)\
$git_branch\
$git_status\
[](fg:#4C566A bg:#2E3440)\
$fill\
$nodejs$rust$golang$python\
[](#2E3440)
$character"""

# Command prompt character
[character]
success_symbol = "[❯](bold green)"
error_symbol = "[❯](bold red)"

# Time display
[time]
disabled = false
format = '[  $time ]($style)'
style = "fg:#D8DEE9 bg:#3B4252"
time_format = "%H:%M"

# Directory display
[directory]
truncation_length = 3
truncate_to_repo = true
format = "[  $path ]($style)"
style = "fg:#D8DEE9 bg:#434C5E"
truncation_symbol = "…/"

# Git status
[git_branch]
symbol = ""
format = "[ $symbol $branch ]($style)"
style = "fg:#D8DEE9 bg:#4C566A"

[git_status]
format = '[($all_status$ahead_behind)]($style)'
style = "fg:#D8DEE9 bg:#4C566A"
conflicted = " ="
ahead = " ⇡"
behind = " ⇣"
diverged = " ⇕"
untracked = " ?"
stashed = " $"
modified = " !"
staged = " +"
deleted = " ✘"

# Language version display (only shown when the corresponding files exist)
[nodejs]
format = "[ 󰎙 $version ](fg:#D8DEE9 bg:#2E3440)"
detect_files = ["package.json", ".node-version"]
detect_folders = ["node_modules"]

[rust]
format = "[ 󱘗 $version ](fg:#D8DEE9 bg:#2E3440)"
detect_files = ["Cargo.toml"]

[golang]
format = "[ 󰟓 $version ](fg:#D8DEE9 bg:#2E3440)"
detect_files = ["go.mod"]

[python]
format = "[ 󰌠 $version ](fg:#D8DEE9 bg:#2E3440)"
detect_files = ["requirements.txt", "pyproject.toml", "Pipfile"]

# Disable less-used modules to reduce clutter
[package]
disabled = true

[aws]
disabled = true

[gcloud]
disabled = true

[azure]
disabled = true

A few tricks that noticeably improve the experience

1. Conditional rendering

Starship’s detect_files and detect_folders are powerful. In the config above, for example, the node version only shows when there’s a package.json or node_modules, so entering a system directory doesn’t flood the prompt with version numbers.

2. Command execution time hint

[cmd_duration]
min_time = 2000
format = "[ ⏱ $duration ](yellow)"

Any command taking over 2 seconds displays its duration, which is very intuitive when troubleshooting performance.

3. Working with Direnv

If you use direnv to manage project environment variables, Starship’s [env_var] module can display the currently active environment right in the prompt:

[env_var.VIRTUAL_ENV]
format = "[ 🐍 $env_value ](cyan)"

4. Cloud config sync

Starship natively supports saving your config to the cloud, making multi-device sync convenient:

starship config sync

What the migration actually felt like

Switching over from Oh My Zsh, the first week was a bit rough. Without all those “smart” plugins, a lot of functionality has to be configured yourself.

But starting the second week, I began to appreciate the benefits:

  • New terminal windows open almost instantly, without that “hold on, let me load” lurch.
  • Every option in the config file is something I understand, so debugging no longer feels like fumbling in the dark.
  • SSH-ing into a server just requires copying a single toml file, and the environment is consistent.

The most unexpected part: because configuring it forces me to actively think about “what information do I actually need,” it actually deepened my understanding of terminal prompts. With Oh My Zsh, someone else told me what mattered; with Starship, I decide what matters myself.

When should you not use Starship?

To be fair, Starship isn’t a silver bullet:

  • If you rely heavily on a specific Oh My Zsh plugin that Starship has no equivalent module for, the migration cost may be significant.
  • If you like an out-of-the-box experience and don’t want to spend time tuning configs, Oh My Zsh’s theme ecosystem is still richer.
  • If you’re using CMD on Windows, Starship needs to be paired with Clink, which makes configuration relatively awkward.

But for most developers—especially backend or full-stack engineers working across platforms—Starship’s simplicity and consistency are genuinely worth a try.

Final thoughts

Migrating tools is never the goal; boosting efficiency is.

Starship made me rethink the essence of “the terminal prompt”: it shouldn’t be an ostentatious decoration, but an entry point for efficiently gathering information and making fast decisions. The performance gains from the Rust rewrite are just the surface; the real value lies in that sense of certainty—“everything is under my control.”

If you’re also fed up with Oh My Zsh’s startup delay, or you want to try a more modern, more transparent shell experience, then give Starship half an hour.

After all, the number of times we open a terminal each day might be greater than the number of times we open WeChat. It’s worth investing a little optimization into it.


Reference links:

文章作者:阿文
文章链接: https://www.awen.me/post/73723dac.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿文的博客!
本文于 2026-03-28 10:30 发布,已超过半年(202天),请注意甄别内容是否已过期。

评论

0 条评论
😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️
加载中...

留言反馈

😀😃😄 😁😅😂 🤣😊😇 🙂🙃😉 😌😍🥰 😘😗😙 😚😋😛 😝😜🤪 🤨🧐🤓 😎🥸🤩 🥳😏😒 😞😔😟 😕🙁☹️ 😣😖😫 😩🥺😢 😭😤😠 😡🤬🤯 😳🥵🥶 😱😨😰 😥😓🤗 🤔🤭🤫 🤥😶😐 😑😬🙄 😯😦😧 😮😲🥱 😴🤤😪 😵🤐🥴 🤢🤮🤧 😷🤒🤕 🤑🤠😈 👿👹👺 🤡💩👻 💀☠️👽 👾🤖🎃 😺😸😹 😻😼😽 🙀😿😾 👍👎👏 🙌👐🤲 🤝🤜🤛 ✌️🤞🤟 🤘👌🤏 👈👉👆 👇☝️✋ 🤚🖐️🖖 👋🤙💪 🦾🖕✍️ 🙏💅🤳 💯💢💥 💫💦💨 🕳️💣💬 👁️‍🗨️🗨️🗯️ 💭💤❤️ 🧡💛💚 💙💜🖤 🤍🤎💔 ❣️💕💞 💓💗💖 💘💝💟 ☮️✝️☪️ 🕉️☸️✡️ 🔯🕎☯️ ☦️🛐⛎ ♈♉♊ ♋♌♍ ♎♏♐ ♑♒♓ 🆔⚛️🉑 ☢️☣️📴 📳🈶🈚 🈸🈺🈷️ ✴️🆚💮 🉐㊙️㊗️ 🈴🈵🈹 🈲🅰️🅱️ 🆎🆑🅾️ 🆘❌⭕ 🛑⛔📛 🚫💯💢 ♨️🚷🚯 🚳🚱🔞 📵🚭❗ ❕❓❔ ‼️⁉️🔅 🔆〽️⚠️ 🚸🔱⚜️ 🔰♻️✅ 🈯💹❇️ ✳️❎🌐 💠Ⓜ️🌀 💤🏧🚾 ♿🅿️🈳 🈂🛂🛃 🛄🛅🛗 🚀🛸🚁 🚉🚆🚅 ✈️🛫🛬 🛩️💺🛰️