A simple CLI to manage and switch between multiple Starship prompt configurations.
- Goal: Quickly switch between Starship prompt “presets” (e.g., a minimal prompt vs. a verbose one).
- Language: Rust – coded with the aid of ChatGPT (More on that on #Disclaimer).
- Motivation:
- I frequently had an overly verbose prompt (Git, Python venv, Cloud environment, etc.) when I didn’t need all that info 24/7.
- This tool allows a default, minimal prompt, and an easy “switch” to a more detailed prompt only when I need it.
- List all
.tomlpresets in~/.config/starship_presets. - Set any preset as the active
STARSHIP_CONFIGand spawn a new shell.
- Multiple Starship Configs: Maybe you have separate
.tomlfiles for Git, Python venv, AWS, GCP, Azure, minimal, or super-verbose modes. Starshift lets you pick whichever one fits your current workflow. - Session-Specific Verbosity: Start with a minimal prompt, then switch to a verbose config when you jump into a project needing Git status, Cloud profile, Python env details, etc. Once you exit that shell, you’re back to minimal.
- Less Clutter, On Demand: Avoid a cluttered prompt until you really need those extra indicators.
-
Temporary Sessions
- When you run
starshift set <preset>, it spawns a new Zsh process. That process inherits your existing environment (like Python venv orAWS_PROFILE) but does not inherit your in-memory command history. It’s effectively like runningexec zsh. - Opening a brand-new terminal afterward defaults back to whatever you set in your
~/.zshrc.
- When you run
-
Shell Assumption
- Starshift is currently tailored for Zsh. If you’re using Fish, Bash, or another shell, you’ll need to make minor tweaks in
main.rs(e.g., replacezshwithbashorfish).
- Starshift is currently tailored for Zsh. If you’re using Fish, Bash, or another shell, you’ll need to make minor tweaks in
-
History Handling
- In-memory history from your previous shell session isn’t carried over. However, if you use Zsh’s shared history options (
setopt INC_APPEND_HISTORY SHARE_HISTORY), you’ll see near-seamless continuity of commands saved to disk.
- In-memory history from your previous shell session isn’t carried over. However, if you use Zsh’s shared history options (
- ZSH support: This program assumes you'll use Zsh as your main, default shell. Minor adjustments need to be done in the main.rs program to fit your needs for Fish, Bash, etc.
- Rust, Cargo:
cargoinstalled. - Current starship configuration: You need to have already installed starship (starship.rs), and Nerd Fonts (Optional).
- Environment: This works fine on Linux (Debian), also tested on MacOS.
- Clone the repo:
git clone https://github.com/<your-username>/starshift.git cd starshift
- Create a new directory:
mkdir $HOME/.config/starship_presets/ - Move/Copy your own starship TOML presets to this directory, and rename them according to your own specific wants (There are some random presets I placed in this project's sample_configs folder for some use cases - Don't treat them religiously, they're just samples I made on the fly to clarify the intention of this use cases when I was building the project).
- Compile or install with
cargo. Place the binary wherever fits your environment best (i.e./usr/bin/). - By default, you already have your default config file at $HOME/.config/starship.toml which be loaded every time a new shell opens. You can set this one to be your default minimal prompt, then move your custom ones to $HOME/.config/starship_presets/
List Available Presets:
starshift listThis shows all .toml files in ~/.config/starship_presets/.
Set a Preset:
starshift set minimal(It is not necessary to introduce the whole path, or file extension; just "minimal" instead of "minimal.toml")
This will:
Spawn a new Zsh shell.
Set STARSHIP_CONFIG to ~/.config/starship_presets/minimal.toml.
Replace your current shell with the new one. Once you exit, you return to your prior shell (or environment).
This project was largely aided by ChatGPT, and I'm a Rust beginner doing this as a fun weekend experiment. To scratch my own itch for having different, switchable starship configurations and debloat my terminal prompt.