- Create `Config` struct that is added to `Context` when initialized - Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`) - `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
6.9 KiB
Starship
The cross-shell prompt for astronauts.
⚠️ This is very much work in progress, so please don't try to use it just yet!
Starship is a Rust port of the minimalistic, powerful, and extremely customizable prompt Spaceship ZSH.
Development plans
The project is beginning as a port of Spaceship ZSH, but will be improved in areas where Spaceship ZSH was previously limited:
- Speed
- Concurrency of segment logic execution
- Memoization of expensive operations
- Safety and error handling
- Testability of code
- Configuration
- Cross-shell support with JSON or TOML config files
We will not be aiming to achieve full parity with Spaceship ZSH as a result, so I am very open to discussing and reevaluating new solutions and ideas for the prompt.
I'm very new to Rust, so any help is appreciated when it comes to improving development patterns, writing idiomatic Rust, performance, safety, etc. 😄
Prompt segments
- Prompt character turns red if the last command exits with non-zero code.
- Current Node.js version(
⬢
). - Current Rust version (
🦀
). - Current Python version (
🐍
). - Current Go version (
🐹
). - Package version of package in current directory (
📦
). - Current battery level and status
- Current Git branch and rich repo status:
=
— conflicting changes⇡
— ahead of remote branch⇣
— behind of remote branch⇕
— diverged changes?
— untracked changes$
— stashed changes!
— modified files+
— added files»
— renamed files✘
— deleted files
- Indicator for jobs in the background (
✦
). - Execution time of the last command if it exceeds the set threshold.
Other features
starship.toml
configuration- Custom sections given commands or binaries
- Self-updating
Shell support
- Fish shell
- Z Shell
- Bash
Test strategy
- Per-segment benchmarking
- Per-segment unit + integration tests
- Shell + OS matrix acceptance tests
Setup
Prerequisites
- Rust v1.33 or higher
Getting Started
-
cd
to the root of the starship repo -
Install the starship binary:
cargo install --path .
-
Navigate to the adapters directory
cd adapters
Fish
-
Install the fish shell prompt with fisher:
fisher $PWD
oh-my-zsh
-
Install the zsh theme:
cp starship.zsh-theme ~/.oh-my-zsh/themes
-
In
~/.zshrc
, find the line withZSH_THEME=
and set it toZSH_THEME="starship"
Contributing
To test locally run the below command:
cargo run -- $status
Contributors
Thanks goes to these wonderful people (emoji key):
Matan Kushner 💻 🎨 🤔 🚇 🚧 👀 ⚠️ | John Letey 💻 🤔 👀 ⚠️ | Tim Mulqueen 💻 🤔 👀 ⚠️ | Tiffany Le-Nguyen 🤔 🚧 👀 | Snuggle 🎨 🤔 🚧 👀 | Ryan Leckey 👀 | Youssef Habri 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!