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] format = "❯❯ " success_symbol = "❯❯(bold green) " error_symbol = "❯❯(bold red) " # 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 time_format = "%Y-%m-%d %H:%M:%S" utc_time_offset = "+10" # Directory setttings [directory] format = "[$path]($style)[$read_only]($read_only_style) " truncation_length = 4 truncate_to_repo = false truncation_symbol = "…/" [username] disabled = true [hostname] ssh_only = false format = "[$hostname](bold red) ❯ " # Workaround for slow prompt with git status [git_status] disabled = true
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.