Skip to main content

Boost your shell

Oh My Zsh and plugins in Mac OS terminal / iTerm 2 and VS Code

Here, you’ll find an automated setup script that installs Oh My Zsh and the most useful plugins, aliases, and enhancements I use. It includes:

  • eza (better ls)
  • zoxide (better cd)
  • fzf (fuzzy finder)
  • zsh-autosuggestions
  • zsh-syntax-highlighting
  • powerlevel10k (customizable prompt)
  • Git shortcuts

πŸš€ Steps to Use:​

  1. Save this script as setup_zsh.sh
  2. Run it with: chmod +x setup\zsh.sh && ./setup\zsh.sh

Automated Setup Script​

#!/bin/bash

echo "πŸš€ Starting Zsh environment setup for software engineers..."

# Ensure dependencies are available
if ! command -v brew &> /dev/null; then
echo "❌ Homebrew not found! Please install Homebrew first: https://brew.sh/"
exit 1
fi

# Install Oh My Zsh if not installed
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "πŸ”Ή Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "βœ… Oh My Zsh is already installed."
fi

# Install powerlevel10k theme
if [ ! -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" ]; then
echo "🎨 Installing Powerlevel10k..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
else
echo "βœ… Powerlevel10k is already installed."
fi

# Install useful plugins
PLUGINS=(
zsh-autosuggestions
zsh-syntax-highlighting
zoxide
fzf
eza
bat
lsd
autojump
htop
)

echo "πŸ“¦ Installing plugins and utilities..."
brew install "${PLUGINS[@]}"

# Set up Zsh plugins
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"

# zsh-autosuggestions
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
fi

# zsh-syntax-highlighting
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
fi

# Configure .zshrc
echo "βš™οΈ Configuring .zshrc..."

cat <<EOF > ~/.zshrc
export ZSH="\$HOME/.oh-my-zsh"

# Theme
ZSH_THEME="powerlevel10k/powerlevel10k"

# Enable Plugins
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

source \$ZSH/oh-my-zsh.sh

# Aliases
alias ls='eza --icons --group-directories-first'
alias ll='eza -lh --icons --group-directories-first'
alias la='eza -lha --icons --group-directories-first'
alias l='ls'
alias ..='cd ..'
alias ...='cd ../..'
alias gs='git status'
alias gc='git commit -m'
alias gpl='git pull'
alias gps='git push'
alias cls='clear'
alias f='fzf'
alias duf='du -sh * | sort -h'
alias cat='bat --paging=never'

# fzf keybindings
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

# Enable zoxide
eval "\$(zoxide init zsh)"

# Powerlevel10k instant prompt
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
EOF

echo "βœ… Setup complete! Restart your terminal or run 'source ~/.zshrc' to apply changes."

After running this, restart your terminal or run: source ~/.zshrc

πŸš€ After running through the setup wizard for powerlevel10k, you have a powerful Zsh setup! πŸŽ‰

Adjust VS Code Terminal​

To also customize the settings in VSCode, follow these steps:

If you are using a light theme but still want the terminal, especially with the above extensions, to always be dark:

  1. Open the settings (Ctrl + , or Cmd + , on macOS).
  2. Search for β€œworkbench.colorCustomizations.”
  3. Click on β€œEdit in settings.json.”
  4. Add the following entry:
{
"workbench.colorCustomizations": {
"terminal.background": "#1E1E1E" // Dark background
}
}

You may need to reconfigure the setup to fix the icons by running:

p10k configure