Skip to content

Instantly share code, notes, and snippets.

@howie
Last active July 13, 2025 12:28
Show Gist options
  • Select an option

  • Save howie/f05ed791b26753be24beb7b028cc8624 to your computer and use it in GitHub Desktop.

Select an option

Save howie/f05ed791b26753be24beb7b028cc8624 to your computer and use it in GitHub Desktop.
Install YARD dotfile
#
# Lastest update: 2025
#
#!/bin/bash
set -euo pipefail
# Detect architecture and brew path (for M1/M2 Macs)
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
else
eval "$(/usr/local/bin/brew shellenv)"
fi
# -------------------------------
# Install YADR core dotfiles
# -------------------------------
if [ ! -d "$HOME/.yadr" ]; then
echo "Installing YADR dotfiles..."
bash -c "$(curl -fsSL https://raw.githubusercontent.com/skwp/dotfiles/master/install.sh)"
else
echo "YADR already installed."
fi
# -------------------------------
# Install oh-my-zsh
# -------------------------------
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing oh-my-zsh..."
RUNZSH=no KEEP_ZSHRC=yes bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "oh-my-zsh already installed."
fi
# -------------------------------
# Install zsh plugins
# -------------------------------
ZSH_CUSTOM=${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
echo "Installing zsh-autosuggestions..."
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
else
echo "zsh-autosuggestions already installed."
fi
# -------------------------------
# Setup agnoster zsh prompt
# -------------------------------
ZSH_PROMPT_DIR="$HOME/.zsh.prompts"
AGNOSTER_FILE="$ZSH_PROMPT_DIR/prompt_agnoster_setup"
if [ ! -f "$AGNOSTER_FILE" ]; then
echo "Installing agnoster zsh theme..."
mkdir -p "$ZSH_PROMPT_DIR"
curl -fsSL \
https://gist.githubusercontent.com/agnoster/3712874/raw/c3107c06c04fb42b0ca27b0a81b15854819969c6/agnoster.zsh-theme \
-o "$AGNOSTER_FILE"
else
echo "agnoster.zsh-theme already exists."
fi
# -------------------------------
# Install custom zsh scripts
# -------------------------------
YADR_ZSH_DIR="$HOME/.yadr/zsh"
mkdir -p "$YADR_ZSH_DIR"
if [ ! -f "$YADR_ZSH_DIR/get-short-path.zsh" ]; then
curl -fsSL \
https://gist.githubusercontent.com/howie/b7bec91e4af9f3b679b7e1d36eea8e49/raw/get-short-path.zsh \
-o "$YADR_ZSH_DIR/get-short-path.zsh"
else
echo "get-short-path.zsh already exists."
fi
if [ ! -f "$YADR_ZSH_DIR/git-omz.zsh" ]; then
curl -fsSL \
https://gist.githubusercontent.com/howie/ffc444e946eb0fe70a198be9caac324b/raw/git-omz.zsh \
-o "$YADR_ZSH_DIR/git-omz.zsh"
else
echo "git-omz.zsh already exists."
fi
# -------------------------------
# Install fonts via Homebrew
# -------------------------------
FONTS=(
font-hack-nerd-font
font-source-code-pro
font-fontawesome
font-inconsolata-dz-for-powerline
font-menlo-for-powerline
)
for font in "${FONTS[@]}"; do
if brew list --cask --versions "$font" >/dev/null 2>&1; then
echo "$font is already installed."
else
brew install --cask "$font"
fi
done
# -------------------------------
# Configure zshrc prompt setup
# -------------------------------
if ! grep -q "autoload -Uz promptinit" "$HOME/.zshrc"; then
echo "autoload -Uz promptinit" >> "$HOME/.zshrc"
echo "promptinit" >> "$HOME/.zshrc"
echo "prompt agnoster" >> "$HOME/.zshrc"
fi
if ! grep -q "zsh-autosuggestions" "$HOME/.zshrc"; then
echo "plugins+=(zsh-autosuggestions)" >> "$HOME/.zshrc"
fi
# -------------------------------
# Reload zsh config
# -------------------------------
if [ "$SHELL" = "/bin/zsh" ]; then
echo "Reloading .zshrc..."
source "$HOME/.zshrc"
else
echo "You may need to restart your terminal or run 'zsh' to apply changes."
fi
# -------------------------------
# Optional: manual font install
# -------------------------------
# curl -fsSL \
# https://gist.githubusercontent.com/qrush/1595572/raw/mensch-Powerline.otf \
# -o mensch-Powerline.otf
# open mensch-Powerline.otf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment