Customize Warp Terminal With Starship And Custom Theme
The following guide demonstrates how to customize warp terminal with custom starship prompt and custom theme. Let’s get started.
Prerequisite
Organizing zsh
The default .zshrc
is a mess. We need to make it simpler and make configs modular with separate files and folders. In order to do that please go through this article first ~ Organize Your Zsh Configurations and Plugins.
Installing warp
The terminal for the 21st century. WARP is a blazingly fast, Rust
based terminal reimagined from the ground up to work like modern app. More about warp. To install ~
brew install --cask warp
Installing starship
The minimal, blazing-fast, and infinitely customizable prompt for any shell! Starship is cross platform regardless of shell. More about starship. To install ~
brew install starship
Nerd font
Nerd Fonts patches developer targeted fonts with a high number of glyphs (icons). These glyps we make our prompt beautiful đ. There are a lot of nerd fonts availabe. You can download the font you like most. For me it is Meslo
. Check Nerd Fonts to download your favorite font. In this guide I am going to use MesloLG Nerd Font
. Download MesloLG Nerd Font and install the font.
Warp
Let’s get started with warp first.
Change font
Open your warp terminal. Go to settings by pressing command/ctrl + ,(comma). Select Appearance
and scorll down to find terminal font. From the dropdown select Mono
version of your installed nerd font. For my case it is MesloLGS Nerd Font Mono
.
Features
Now select the feature tab and you can enable the features you like. But it is recomended to enable Honor user's custom prompt(PS1)
and Open completions menu as you type
.
Note: if Honor user’s custom prompt(PS1) is not enabled our starship prompt will not be visible in warp.
Theming
In warp we can create our own themes and workspaces. In this guide we are only going to create a theme. To get started create a file ~/.warp/themes/sayeed.yml
~
mkdir -p ~/.warp/themes && touch ~/.warp/themes/sayeed.yml
Note: The name of the file will be the name of the theme.
Now paste these lines in the yml file we created ~
accent: "#2196f3" # Accent color for UI elements
background: "#1a1d21" # Terminal background color
details: darker # Whether the theme is lighter or darker.
foreground: "#f1f1f1" # The foreground color.
terminal_colors: # Ansi escape colors.
bright:
black: "#212121"
blue: "#2196f3"
cyan: "#00bcd4"
green: "#4caf50"
magenta: "#D80073"
red: "#f44336"
white: "#ffffff"
yellow: "#ffeb3b"
normal:
black: "#212121"
blue: "#2196f3"
cyan: "#00bcd4"
green: "#4caf50"
magenta: "#D80073"
red: "#f44336"
white: "#f1f1f1"
yellow: "#ffeb3b"
It is time to activate the theme in the Appearance setting of warp.
Starship
Let’s customize our prompt.
Config
We need a config file, that will contain all configuration related to starship. To get started configuring starship, create the following file: ~/.config/starship.toml
.
mkdir -p ~/.config && touch ~/.config/starship.toml
This will create the .config
directory if it is not available and create the starship.toml
file as well. All configuration for starship is done in this TOML file. Copy below configurations and paste in the starship.toml
file:
# Inserts a blank line between shell prompts
add_newline = true
# Change command timeout from 500 to 1000 ms
command_timeout = 1000
# Change the default prompt format
format = """$env_var $all"""
# Change the default prompt characters
[character]
success_symbol = ""
error_symbol = ""
# Shows an icon that should be included by zshrc script based on the distribution or os
[env_var.STARSHIP_DISTRO]
format = '[$env_value](white)'
variable = "STARSHIP_DISTRO"
disabled = false
# Shows the username
[username]
style_user = "green"
style_root = "red"
format = "[$user]($style) "
disabled = false
show_always = true
[hostname]
ssh_only = false
format = "on [$hostname](blue) "
disabled = false
[directory]
truncation_length = 1
truncation_symbol = "../"
home_symbol = "ī ~"
read_only_style = "197"
read_only = " īŖ "
format = "at [$path]($style)[$read_only]($read_only_style) "
[git_branch]
symbol = "īĄ "
format = "[$symbol$branch]($style) "
# truncation_length = 4
truncation_symbol = "âĻ/"
style = "bold green"
[git_status]
format = '[\($all_status$ahead_behind\)]($style) '
style = "bold green"
conflicted = "đŗ"
up_to_date = "ī "
untracked = "īŠ "
ahead = "âĄ${count}"
diverged = "ââĄ${ahead_count}âŖ${behind_count}"
behind = "âŖ${count}"
stashed = "īŖ "
modified = "ī "
staged = '[++\($count\)](green)'
renamed = "īĒļ "
deleted = "ī "
[kubernetes]
format = 'via [ī´ą $context\($namespace\)](bold purple) '
disabled = false
# (deactivated because of no space left)
[terraform]
format = "via [īĩ terraform $version]($style) īĨ [$workspace]($style) "
disabled = true
[vagrant]
format = "via [īĩ vagrant $version]($style) "
disabled = true
[docker_context]
format = "via [ī $context](bold blue) "
disabled = true
[helm]
format = "via [ī $version](bold purple) "
disabled = true
[python]
symbol = "ī "
python_binary = "python3"
disabled = true
[nodejs]
format = "via [īĸ $version](bold green) "
disabled = true
[ruby]
format = "via [îž $version]($style) "
disabled = true
You can always check the official configuration doc and make changes in the file as your liking.
OS icon
We are using a variable STARSHIP_DISTRO
in our configuration which will show the os distribution icon at the begining of our prompt. But the variable is not initialized yet. Create a new file ~/.config/zsh/starship.zsh
~
mkdir -p ~/.config/zsh && touch ~/.config/zsh/starship.zsh
Paste these lines in the file ~
# find out which distribution we are running on
LFILE="/etc/*-release"
MFILE="/System/Library/CoreServices/SystemVersion.plist"
if [[ -f $LFILE ]]; then
_distro=$(awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }')
elif [[ -f $MFILE ]]; then
_distro="macos"
fi
# set an icon based on the distro
# make sure your font is compatible with https://github.com/lukas-w/font-logos
case $_distro in
*kali*) ICON="ī´Ŗ";;
*arch*) ICON="ī";;
*debian*) ICON="îŊ";;
*raspbian*) ICON="ī";;
*ubuntu*) ICON="ī";;
*elementary*) ICON="ī";;
*fedora*) ICON="ī";;
*coreos*) ICON="ī
";;
*gentoo*) ICON="ī";;
*mageia*) ICON="ī";;
*centos*) ICON="ī";;
*opensuse*|*tumbleweed*) ICON="ī";;
*sabayon*) ICON="ī";;
*slackware*) ICON="ī";;
*linuxmint*) ICON="ī";;
*alpine*) ICON="ī";;
*aosc*) ICON="ī";;
*nixos*) ICON="ī";;
*devuan*) ICON="ī";;
*manjaro*) ICON="ī";;
*rhel*) ICON="ī";;
*macos*) ICON="ī´";;
*) ICON="ī
ŧ";;
esac
export STARSHIP_DISTRO="$ICON"
Finally source the file and init starship in the ~/.zshrc
~
[[ -f ~/.config/zsh/starship.zsh ]] && source ~/.config/zsh/starship.zsh
# Load Starship
eval "$(starship init zsh)"
Note: Paste these lines at the bottom of the file
We are done for now đĨŗ. Close all your terminal session and reopen warp to see the difference. Here’s my final warp + starship ~
Happy Hacking đ