Configuring Starship on Manjaro and Zsh#
Recently, I’ve been switching multiple tools in my daily work, including changes in handling the Linux terminal. One of these changes is the shell prompt (the terminal indicator), and I’m using starship. However, there are some undocumented details on how to enable it on Manjaro with zsh, which I’ll explain here.
To start, first, a terminal indicator is a program that generates text associated with each command execution in the terminal, along with what comes before the cursor. A good terminal indicator provides us with useful information quickly about the directory we are in, the execution of a command line, or even the battery level. Starship delivers this and forms part of the new ecosystem of utilities developed in Rust.
Installing Starship#
In Manjaro, you have starship available in the official repository, but you can also install it from the official installation routine that applies to any Linux distribution (useful if you use a distro like Ubuntu).
sudo pamac install starship --no-confirm
curl -sS https://starship.rs/install.sh | sh
Starting Starship#
When using zsh, you can initialize it by adding the init
command to
the ~/.zshrc
file.
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
source ~/.zshrc
The default terminal language is bash, and if you are comfortable with this, initializing it looks like this.
echo 'eval "$(starship init bash)"' >> ~/.bashrc
source ~/.bashrc
Finally, we are ready, or at least according to the official procedure.
In Manjaro, zsh has a default terminal indicator configuration in the
file ~/.zshrc
and in the file /usr/share/zsh/manjaro-zsh-prompt
.
This configuration enables powerline and powerlevel10k (p10k) and avoids
using an additional prompt.
It’s necessary to disable the use of these two. To do this, we must set
USE_POWERLINE
to false
and comment out (or delete) the lines of the prompt
configuration.
# Use powerline
USE_POWERLINE="false"
# Has weird character width
# Example:
# is not a diamond
HAS_WIDECHARS="false"
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
#if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
# source /usr/share/zsh/manjaro-zsh-prompt
#fi
After sourcing the .zshrc
file, you should have starship enabled on Manjaro
with Zsh.
source ~/.zshrc
Configuration File#
In general, the default configuration is good and significant changes are not
necessary. However, the gcloud module shows up generally in the
session which is not appealing or useful for me. For this reason, I create the
configuration file ~/.config/starship.toml
and disable the module.
cat << 'EOF' > ~/.config/starship.toml
[gcloud]
disabled = true
EOF
You can consult other configuration options in Starship: Configuration.