Skip to content

Instantly share code, notes, and snippets.

@afifmohammed
Last active December 18, 2025 01:54
Show Gist options
  • Select an option

  • Save afifmohammed/b4b51db1aa49e79106d78e0281833295 to your computer and use it in GitHub Desktop.

Select an option

Save afifmohammed/b4b51db1aa49e79106d78e0281833295 to your computer and use it in GitHub Desktop.
Ghostty Terminal Dotfiles

Ghostty Terminal Enhancement Dotfiles

One-click setup for a Warp-like terminal experience in Ghostty.

Features

  • Syntax highlighting - Valid commands green, invalid red
  • Autosuggestions - Ghost text from history (press → to accept)
  • Fuzzy history - Ctrl+R to search
  • Fuzzy file finder - Ctrl+T to find files
  • Smart cd - z docs jumps to your most-used "docs" directory
  • Beautiful prompt - Powerlevel10k with git status, icons

Quick Install

# Clone and run
git clone https://gist.github.com/YOUR_GIST_ID.git dotfiles
cd dotfiles
./setup.sh

What Gets Installed

Homebrew packages:

  • fzf - Fuzzy finder
  • zoxide - Smart cd
  • antidote - Plugin manager
  • font-meslo-lg-nerd-font - Icons for prompt

Dotfiles:

  • ~/.zshrc - Main config (modular loader)
  • ~/.zshrc.pre - Your machine-specific config
  • ~/.zsh_plugins.txt - Plugin list
  • ~/.p10k.zsh - Prompt theme

After Install

  1. Quit and reopen Ghostty
  2. Run p10k configure if the wizard doesn't auto-start
  3. Edit ~/.zshrc.pre for machine-specific paths/aliases

Customization

  • Add plugins: Edit ~/.zsh_plugins.txt, run antidote update
  • Change prompt: Run p10k configure
  • Machine config: Edit ~/.zshrc.pre

Rollback

cp ~/.zshrc.backup.* ~/.zshrc
exec zsh
# Ghostty configuration
# Nerd Font for Powerlevel10k icons
font-family = "MesloLGS Nerd Font"
font-size = 13
# Theme: follow macOS light/dark with Rose Pine
theme = light:rose-pine-dawn,dark:rose-pine
# Optional tweaks
cursor-style = block
window-padding-x = 8
window-padding-y = 8
#!/bin/bash
# Ghostty + Zsh Enhancement Setup
# Run: curl -fsSL <raw-gist-url>/setup.sh | bash
# Or: git clone <gist-url> dotfiles && cd dotfiles && ./setup.sh
set -e
echo "🚀 Setting up Ghostty terminal enhancements..."
# ── Step 1: Check prerequisites ─────────────────────────────────────────────
if [[ "$SHELL" != */zsh ]]; then
echo "❌ Please switch to zsh first: chsh -s /bin/zsh"
exit 1
fi
if ! command -v brew &>/dev/null; then
echo "❌ Homebrew not found. Install from https://brew.sh"
exit 1
fi
# ── Step 2: Install tools ───────────────────────────────────────────────────
echo "📦 Installing tools via Homebrew..."
brew install fzf zoxide antidote
brew install --cask font-meslo-lg-nerd-font
# ── Step 3: Backup existing config ──────────────────────────────────────────
if [[ -f ~/.zshrc ]]; then
BACKUP=~/.zshrc.backup.$(date +%Y%m%d-%H%M%S)
cp ~/.zshrc "$BACKUP"
echo "📁 Backed up existing .zshrc to $BACKUP"
fi
# ── Step 4: Get script directory (works for both clone and curl) ────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# ── Step 5: Install dotfiles ────────────────────────────────────────────────
echo "📝 Installing dotfiles..."
# Copy files from gist/repo
cp "$SCRIPT_DIR/zshrc" ~/.zshrc
cp "$SCRIPT_DIR/zsh_plugins.txt" ~/.zsh_plugins.txt
# Create .zshrc.pre if it doesn't exist (machine-specific config goes here)
if [[ ! -f ~/.zshrc.pre ]]; then
cp "$SCRIPT_DIR/zshrc.pre.template" ~/.zshrc.pre
echo "📝 Created ~/.zshrc.pre - edit this for machine-specific settings"
fi
# Copy p10k config if included
if [[ -f "$SCRIPT_DIR/p10k.zsh" ]]; then
cp "$SCRIPT_DIR/p10k.zsh" ~/.p10k.zsh
fi
# ── Step 6: Setup Ghostty config ────────────────────────────────────────────
GHOSTTY_DIR="$HOME/Library/Application Support/com.mitchellh.ghostty"
if [[ -d "$GHOSTTY_DIR" ]]; then
if [[ -f "$GHOSTTY_DIR/config" ]]; then
# Update font in existing config
if grep -q "font-family" "$GHOSTTY_DIR/config"; then
sed -i '' 's/font-family = .*/font-family = "MesloLGS Nerd Font"/' "$GHOSTTY_DIR/config"
else
echo 'font-family = "MesloLGS Nerd Font"' >> "$GHOSTTY_DIR/config"
fi
else
cp "$SCRIPT_DIR/ghostty.config" "$GHOSTTY_DIR/config"
fi
echo "👻 Ghostty config updated"
fi
# ── Step 7: Initialize plugins ──────────────────────────────────────────────
echo "🔌 Initializing plugins (this may take a moment)..."
zsh -c 'source ~/.zshrc' 2>/dev/null || true
# ── Done! ───────────────────────────────────────────────────────────────────
echo ""
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo " 1. Quit and reopen Ghostty (to load the new font)"
echo " 2. Run 'p10k configure' if prompt wizard doesn't start automatically"
echo " 3. Edit ~/.zshrc.pre for machine-specific paths/aliases"
echo ""
# Plugins managed by antidote
# Comment out any line to disable that plugin
# Prompt theme
romkatv/powerlevel10k
# Core enhancements (order matters - syntax highlighting must be last)
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# ~/.zshrc - Modular loader
# ─────────────────────────────────────────────────────────────────────────────
# ── Your original config (paths, aliases, NVM, etc.) ────────────────────────
[[ -f ~/.zshrc.pre ]] && source ~/.zshrc.pre
# ── History settings ────────────────────────────────────────────────────────
HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=50000
setopt INC_APPEND_HISTORY # Write immediately, not on exit
setopt SHARE_HISTORY # Share across terminals
setopt HIST_IGNORE_ALL_DUPS # No duplicates
setopt HIST_REDUCE_BLANKS # Trim whitespace
# ── fzf (fuzzy finder) ──────────────────────────────────────────────────────
# Provides: Ctrl+R (history), Ctrl+T (files), Alt+C (cd)
if command -v fzf &>/dev/null; then
source <(fzf --zsh)
fi
# ── zoxide (smart cd) ───────────────────────────────────────────────────────
# Use: z <partial-path> to jump to frequent directories
if command -v zoxide &>/dev/null; then
eval "$(zoxide init zsh)"
fi
# ── Antidote plugin manager ─────────────────────────────────────────────────
# Loads plugins from ~/.zsh_plugins.txt
ANTIDOTE_PATH="$(brew --prefix 2>/dev/null)/opt/antidote/share/antidote/antidote.zsh"
if [[ -f "$ANTIDOTE_PATH" ]]; then
source "$ANTIDOTE_PATH"
[[ -f ~/.zsh_plugins.txt ]] && antidote load
fi
# ── Powerlevel10k config ────────────────────────────────────────────────────
# Run `p10k configure` to customize your prompt
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
# ~/.zshrc.pre - Machine-specific configuration
# This file is sourced before plugins. Add your paths, aliases, and tools here.
# ─────────────────────────────────────────────────────────────────────────────
# Enable Zsh completions
autoload -Uz compinit && compinit
autoload -U +X bashcompinit && bashcompinit
# ── Custom aliases ──────────────────────────────────────────────────────────
# alias ll="ls -la"
# alias flush="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
# ── PATH additions ──────────────────────────────────────────────────────────
# export PATH="$HOME/.local/bin:$PATH"
# ── NVM (Node Version Manager) ──────────────────────────────────────────────
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# ── Add your machine-specific config below ──────────────────────────────────
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment