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:β
- Save this script as setup_zsh.sh
- 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:
- Open the settings (
Ctrl + ,
orCmd + ,
on macOS). - Search for βworkbench.colorCustomizations.β
- Click on βEdit in settings.json.β
- 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