Next up, is the setup of the Z-Shell.
The easiest way to get more out of the zsh shell is to install oh-my-zsh. It installs itself underneath dot oh-my-zsh in the user home directory. The installation is done with the following command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
The installation will rename .zshrc file to .zshrc.pre-oh-my-zsh and automatically activate oh-my-zsh.
Besides oh-my-zsh, I have a few other helpers activated in my terminal. This is the dot zshrc that I use. Be aware that you need to install the starship prompt from the next chapter first, otherwise the configuration will cause an error.
# zsh configuration file
#
# Author: Thomas Bendler <code@thbe.org>
# Date: Sat Nov 2 11:58:37 CET 2024
#
# Apple M1 homebrew settings
eval $(/opt/homebrew/bin/brew shellenv)
# Initialize Zoxide
eval "$(zoxide init zsh)"
# Set up fzf key bindings and fuzzy completion
[ -e $(brew --prefix)/bin/fzf ] && source <(fzf --zsh)
# Path to the oh-my-zsh installation.
export ZSH="${HOME}/.oh-my-zsh"
# Use case-sensitive completion.
CASE_SENSITIVE="true"
# Define how often to auto-update (in days).
export UPDATE_ZSH_DAYS=7
# Enable command auto-correction.
#ENABLE_CORRECTION="true"
# Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Configure history
HIST_STAMPS="yyyy-mm-dd"
HISTSIZE=20000
SAVEHIST=20000
setopt histignorespace
setopt hist_ignore_all_dups
setopt append_history
setopt share_history
# Oh-My-Zsh plugin configuration
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
plugins=(
aliases
ansible
brew
colored-man-pages
colorize
git
macos
nmap
starship
tmux
you-should-use
zsh-navigation-tools
)
# Set oh-my-zsh theme
# ZSH_THEME=gentoo
# Autoload tmux on startup
ZSH_TMUX_AUTOSTART=true
# Force Unicode for tmux
ZSH_TMUX_UNICODE=true
# Load oh-my-zsh framework
[ -e ${ZSH}/oh-my-zsh.sh ] && source ${ZSH}/oh-my-zsh.sh
# Local custom snippets
for item in $(ls -1 ${HOME}/.config/zsh/custom/*.plugin.zsh); do
[ -e "${item}" ] && source "${item}"
done
# Load SAP BTP autocomplete for CLI
SAP_BTP_CLI_AUTOCOMPLETE="${HOME}/Library/Application Support/.btp/autocomplete/scripts/sapbtpcli-autocomplete.plugin.zsh" && fpath=("${SAP_BTP_CLI_AUTOCOMPLETE}" $fpath) && autoload -U compinit && compinit && source "${SAP_BTP_CLI_AUTOCOMPLETE}"
# Load Zsh extension for syntax highlighting
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load Zsh extension for autosuggestions
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Load Zsh extension for autocompletion
#source $(brew --prefix)/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh
As mentioned, you need to install the starship prompt first. The installation itself is pretty straight forward:
brew install starship
Next you need to add the starship prompt to oh-my-zsh. This could be achieved best with a custom plugin:
mkdir -p ~/.oh-my-zsh/custom/plugins/zsh-starship
Create a file called starship.plugin.zsh in the newly created folder with the following content:
# ignore oh-my-zsh theme
unset ZSH_THEME
if (( $+commands[starship] )); then
eval "$(starship init zsh)"
else
echo '[oh-my-zsh] starship not found, please install it from homebrew'
fi
Already quite solid, but not yet exactly what I’m aiming for. I would like to have some more information displayed within the terminal depending on what I’m doing. This will come with tmux, but before I start with tmux, I will first talk about some command line tool replacements.
In the next post I will describe the customizing of the terminal environment before I continue with the installation and customizing of the Neovim application.