Skip to content

Latest commit

 

History

History
207 lines (165 loc) · 3.93 KB

File metadata and controls

207 lines (165 loc) · 3.93 KB

Quick Reference Guide

🚀 Common Commands

Install Configs on New Machine

git clone <your-repo-url> ~/terminal-config
cd ~/terminal-config
./setup.sh

Update Configs from System to Repo

cd ~/terminal-config
./update-configs.sh
git add .
git commit -m "Update configs"
git push

Pull Latest Configs from Repo

cd ~/terminal-config
git pull
./setup.sh  # Apply updates

Reload Shell After Changes

# For Zsh
source ~/.zshrc

# For Bash
source ~/.bashrc

# Or start new shell session
exec $SHELL

📁 File Locations

Config System Location Repo Location
Zsh Config ~/.zshrc .zshrc
Zsh Profile ~/.zprofile .zprofile
Bash Config ~/.bashrc .bashrc
Bash Profile ~/.bash_profile .bash_profile
Git Config ~/.gitconfig .gitconfig
Tmux Config ~/.tmux.conf .tmux.conf
Neovim Config ~/.config/nvim/ nvim/

🔧 Manual Operations

Backup Current Configs

# Create timestamped backup
tar -czf ~/config-backup-$(date +%Y%m%d).tar.gz \
  ~/.zshrc ~/.bashrc ~/.tmux.conf ~/.gitconfig ~/.config/nvim

Restore from Backup

tar -xzf ~/config-backup-YYYYMMDD.tar.gz -C ~/

Copy Single Config

# From system to repo
cp ~/.zshrc ~/terminal-config/.zshrc

# From repo to system
cp ~/terminal-config/.zshrc ~/.zshrc

🐛 Troubleshooting

Scripts Won't Run

chmod +x ~/terminal-config/setup.sh
chmod +x ~/terminal-config/update-configs.sh

Config Not Loading

# Check file exists
ls -la ~/.zshrc

# Check for errors in config
zsh -n ~/.zshrc  # for zsh
bash -n ~/.bashrc  # for bash

Neovim Issues

# Check health
nvim +checkhealth

# Clear cache
rm -rf ~/.local/share/nvim
rm -rf ~/.cache/nvim

Tmux Config Not Loading

# Kill all tmux sessions
tmux kill-server

# Reload config in running session
tmux source-file ~/.tmux.conf
# or press: prefix + I (capital i)

📝 Git Workflow

First Time Setup

cd ~/terminal-config
git remote add origin <your-repo-url>
git branch -M main
git push -u origin main

Regular Updates

# Pull changes
git pull origin main

# Push changes
./update-configs.sh
git add .
git commit -m "Update: describe changes"
git push origin main

Check What Changed

# See modified files
git status

# See actual changes
git diff

# See specific file changes
git diff .zshrc

🔐 Security Notes

  • Never commit SSH private keys
  • Review .gitconfig before pushing (contains email)
  • Check shell configs for API keys or tokens
  • Consider making repo private if it contains sensitive data
  • Use environment variables for sensitive values

⚡ Pro Tips

  1. Alias for quick updates:

    # Add to .zshrc or .bashrc
    alias config-update='cd ~/terminal-config && ./update-configs.sh'
    alias config-sync='cd ~/terminal-config && git pull && ./setup.sh'
  2. Keep configs modular:

    # In .zshrc, source separate files
    [ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
    [ -f ~/.zsh_functions ] && source ~/.zsh_functions
  3. Machine-specific settings:

    # In .zshrc, use local config for machine-specific stuff
    [ -f ~/.zshrc.local ] && source ~/.zshrc.local
    # Add .zshrc.local to .gitignore
  4. Test before committing:

    # Always test configs in new shell
    zsh -c "source ~/.zshrc && echo 'Config OK'"

📦 Prerequisites Install

macOS (Homebrew)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install git zsh tmux neovim

Ubuntu/Debian

sudo apt update
sudo apt install -y git zsh tmux neovim

Set Zsh as Default Shell

chsh -s $(which zsh)
# Log out and back in

Repository: ~/terminal-config
Last Updated: January 2026