Starship Prompt Install and Configure
18th May 2020
Over the years I have customised my shell prompt to make it "cool" and "informative". Previously I have used powerline and powerlevel10k. Both were pretty nice, with powerlevel10k being the much faster of the two.
I recently came across the Starship project which looks pretty rad. Starship prompt is "The minimal, blazing-fast, and infinitely customizable prompt for any shell!"
This post will cover getting Starship prompt installed and configured for MAC-OSX Catalina and iTerm2 for the zsh shell.
First you need to install some powerline patched fonts.
git clone https://github.com/powerline/fonts.git --depth=1 cd fonts ./install.sh # Output Copying fonts... Powerline fonts installed to /Users/bradmin/Library/Fonts" # Clean up cd .. rm -rf fonts
Install Starship with Homebrew.
brew install starship
Initialise Starship by adding the following to your ~/.zshrc and restarting your shell.
# ~/.zshrc eval "$(starship init zsh)"
Configure iTerm2 to use a Powerline Font.
Starship uses TOML for its configuration data. Create a starship.toml configuration file.
mkdir -p ~/.config && touch ~/.config/starship.toml
The prompt is configured via "modules". The docs outline the options for each module quite well. A sample configuration file can be found below.
# Replace the "❯" symbol in the prompt with "❯❯" [character] symbol = "❯❯" # Disable the package module, hiding it from the prompt completely [package] disabled = true # Disable the AWS module. [aws] disabled = true # Set the time format [time] disabled = false format = "%Y-%m-%d %H:%M:%S" utc_time_offset = "+10" # Directory truncation setttings [directory] truncation_length = 8 truncate_to_repo = false # Workaround for slow prompt with git status [git_status] disabled = false
The result is a really nice looking, responsive and informative prompt.
~ 2020-05-18 18:41:46 ❯❯
I found having the git_status module was causing the prompt to respond really slowly. I disabled this module and the response time went back to normal. There is an open issue for this and hopefully it will be resolved in a future release.
The Starship prompt looks like it does what it says on the tin. It's fast, easily customisable and looks great.