From 6013ed40117e52e4e8e2e307c9f8ab2d5ed54ae2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 29 Nov 2025 20:44:16 +0000 Subject: [PATCH] Improve dotfiles with quick wins and better documentation - Fix path.bash to use bash activation instead of zsh - Add jq and yq to Brewfile for JSON/YAML processing - Create bootstrap.sh script for easy fresh machine setup - Add .tool-versions template file for mise - Remove deprecated brew cask alias - Add comprehensive .gitconfig with useful aliases and settings - Completely rewrite README.md with: - Proper installation instructions - Prerequisites and troubleshooting sections - Configuration structure overview - Customization guide - Fixed screenshot URL reference --- .tool-versions | 9 ++ Brewfile | 2 + README.md | 244 ++++++++++++++++++++++++++++++++++++++++- alias.bash | 3 - bootstrap.sh | 69 ++++++++++++ packages/git/gitconfig | 159 +++++++++++++++++++++++++++ path.bash | 2 +- tasks/symlink.yml | 1 + 8 files changed, 479 insertions(+), 10 deletions(-) create mode 100644 .tool-versions create mode 100755 bootstrap.sh create mode 100644 packages/git/gitconfig diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..3221a26 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,9 @@ +# mise tool versions +# This file defines default tool versions for mise +# Add your preferred versions here + +# Uncomment and set versions as needed: +# nodejs 20.11.0 +# python 3.12.1 +# ruby 3.3.0 +# golang 1.22.0 diff --git a/Brewfile b/Brewfile index 6a033c1..a6a9cb1 100644 --- a/Brewfile +++ b/Brewfile @@ -1,9 +1,11 @@ brew "gh" brew "go-task" +brew "jq" brew "mise" brew "neovim" brew "starship" brew "tmux" +brew "yq" cask "1password" cask "flux-app" diff --git a/README.md b/README.md index d4e04bf..a2b7691 100755 --- a/README.md +++ b/README.md @@ -1,15 +1,247 @@ # ramblerator dotfiles -![iTerm Screenshot](https://raw.githubusercontent.com/astephen2/dotfiles/master/docs/dotfiles.png) +![iTerm Screenshot](https://raw.githubusercontent.com/rambleraptor/dotfiles/master/docs/dotfiles.png) These are the dotfiles that I use on my personal machine. The goal of this repo is to create a completely automated process to setup a new machine with my settings and applications. -# Install Scripts +## Features -This repo contains the following install scripts: +- **Automated Setup**: One-command installation for new machines +- **Cross-platform**: Supports macOS and Linux +- **Task-based**: Uses [go-task](https://taskfile.dev) for organized installation +- **Modern Tools**: Includes mise, starship, tmux, neovim, and more +- **Customizable**: Easy to extend and customize for your needs -* `script/install.sh`: The main install script. Symlinks all files together. Used for GitHub Codespaces. -* `script/symlink.sh`: Symlinks all files together. -* `script/mac_defaults.sh`: Registry changes for Mac OS systems. +## Quick Start +### Bootstrap Installation +For a fresh machine setup, run: + +```bash +bash <(curl -fsSL https://raw.githubusercontent.com/rambleraptor/dotfiles/main/bootstrap.sh) +``` + +This will: +1. Install Homebrew (macOS only) +2. Clone this repository to `~/.dotfiles` +3. Install all dependencies +4. Symlink configuration files +5. Apply macOS defaults (macOS only) + +### Manual Installation + +If you prefer to install manually: + +```bash +# Clone the repository +git clone https://github.com/rambleraptor/dotfiles.git ~/.dotfiles +cd ~/.dotfiles + +# Run the install script +./install +``` + +## Prerequisites + +### macOS +- macOS 10.15 (Catalina) or later +- Xcode Command Line Tools (installed automatically by Homebrew) + +### Linux +- Recent Linux distribution with bash/zsh +- curl and git installed + +## What's Included + +### Applications (via Homebrew) + +**CLI Tools:** +- `gh` - GitHub CLI +- `go-task` - Task runner +- `jq` / `yq` - JSON/YAML processors +- `mise` - Runtime version manager +- `neovim` - Modern vim +- `starship` - Cross-shell prompt +- `tmux` - Terminal multiplexer + +**macOS Apps:** +- 1Password - Password manager +- Flux - Screen color temperature +- Ghostty - Terminal emulator +- Google Chrome - Web browser +- Rectangle - Window management +- Spotify - Music streaming +- Visual Studio Code - Code editor + +### Dotfiles + +- **Zsh**: Shell configuration with custom settings +- **Vim/Neovim**: Sensible defaults with plugins +- **Tmux**: Terminal multiplexing with vim keybindings +- **Git**: Comprehensive aliases and settings +- **Starship**: Beautiful cross-shell prompt +- **Mise**: Runtime version management + +## Configuration Structure + +``` +.dotfiles/ +├── packages/ # Package-specific configurations +│ ├── git/ # Git config +│ ├── mise/ # Mise config +│ ├── starship/ # Starship prompt +│ ├── tmux/ # Tmux config +│ ├── vim/ # Vim config +│ └── zsh/ # Zsh config +├── tasks/ # Task definitions +│ ├── brew.yml # Homebrew tasks +│ ├── mac-defaults.yml # macOS defaults +│ ├── mise.yml # Mise setup +│ └── symlink.yml # Symlinking tasks +├── bin/ # Custom scripts +├── local/ # Machine-specific configs (gitignored) +├── Brewfile # Homebrew packages +├── Taskfile.yml # Main task definitions +├── bootstrap.sh # Bootstrap script +└── install # Main install script +``` + +## Customization + +### Machine-Specific Settings + +Create `~/.dotfiles/local/.localrc` for machine-specific environment variables and settings: + +```bash +# Example local configuration +export DEFAULT_USER=1 +export GITHUB_TOKEN=your_token_here + +# Custom paths +export PATH="/usr/local/custom/bin:$PATH" +``` + +### Git Configuration + +Edit your name and email in `~/.dotfiles/packages/git/gitconfig`: + +```ini +[user] + name = Your Name + email = your.email@example.com +``` + +Or set them in `~/.dotfiles/local/.localrc`: + +```bash +git config --global user.name "Your Name" +git config --global user.email "your.email@example.com" +``` + +### Additional Tools + +Add tool versions to `.tool-versions` for mise: + +``` +nodejs 20.11.0 +python 3.12.1 +ruby 3.3.0 +``` + +### Custom Scripts + +Add executable scripts to `bin/` directory - they'll automatically be in your PATH. + +## Available Tasks + +View all available tasks: + +```bash +task -l +``` + +Common tasks: + +```bash +task install # Full system setup +task brew:install # Install Homebrew packages +task symlink:install # Symlink dotfiles +task mac:mac-defaults # Apply macOS defaults (macOS only) +``` + +## Troubleshooting + +### Symlink Errors + +If you get errors about existing files during symlinking: + +```bash +# Backup existing config +mv ~/.zshrc ~/.zshrc.backup + +# Re-run symlink task +task symlink:install +``` + +### Homebrew Issues + +If Homebrew commands aren't found after installation: + +```bash +# Add Homebrew to PATH (Apple Silicon) +eval "$(/opt/homebrew/bin/brew shellenv)" + +# Add Homebrew to PATH (Intel) +eval "$(/usr/local/bin/brew shellenv)" +``` + +### Shell Changes Not Applied + +After installation, restart your shell or source the config: + +```bash +source ~/.zshrc +``` + +### Permission Issues + +If you encounter permission errors: + +```bash +# Fix ownership of dotfiles +sudo chown -R $(whoami) ~/.dotfiles + +# Make scripts executable +chmod +x ~/.dotfiles/bin/* +chmod +x ~/.dotfiles/bootstrap.sh +chmod +x ~/.dotfiles/install +``` + +### Task Not Found + +If `task` command isn't found: + +```bash +# Install task manually +sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin +export PATH="$PATH:$HOME/.local/bin" +``` + +## Update + +To update dotfiles: + +```bash +cd ~/.dotfiles +git pull +task install +``` + +## Contributing + +Feel free to fork this repository and customize it for your own use. If you find bugs or have suggestions, please open an issue. + +## License + +See [LICENSE](LICENSE) file for details. diff --git a/alias.bash b/alias.bash index 8e38390..69113c5 100644 --- a/alias.bash +++ b/alias.bash @@ -14,7 +14,4 @@ alias gca="git commit --amend" # untar alias untar='tar xvf' -# homebrew -alias cask='brew cask' - alias pubip="dig +short myip.opendns.com @resolver1.opendns.com" diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..67be560 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# bootstrap.sh +# Bootstrap script for setting up a new machine with dotfiles +# + +set -e + +DOTFILES_DIR="$HOME/.dotfiles" +DOTFILES_REPO="https://github.com/rambleraptor/dotfiles.git" + +echo "🚀 Bootstrapping dotfiles setup..." + +# Check if running on macOS or Linux +if [[ "$OSTYPE" == "darwin"* ]]; then + OS="macos" + echo "✓ Detected macOS" +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + OS="linux" + echo "✓ Detected Linux" +else + echo "❌ Unsupported operating system: $OSTYPE" + exit 1 +fi + +# Install Homebrew if on macOS and not installed +if [[ "$OS" == "macos" ]] && ! command -v brew &> /dev/null; then + echo "📦 Installing Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +fi + +# Clone dotfiles repository if not already present +if [[ ! -d "$DOTFILES_DIR" ]]; then + echo "📥 Cloning dotfiles repository..." + git clone "$DOTFILES_REPO" "$DOTFILES_DIR" + cd "$DOTFILES_DIR" +else + echo "✓ Dotfiles directory already exists" + cd "$DOTFILES_DIR" + + # Update repository + echo "🔄 Updating dotfiles repository..." + git pull origin main 2>/dev/null || git pull origin master 2>/dev/null || echo "⚠️ Could not pull latest changes" +fi + +# Install task if not already installed +if ! command -v task &> /dev/null; then + echo "📦 Installing go-task..." + if [[ "$OS" == "macos" ]]; then + brew install go-task + else + # Install task on Linux + sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin + export PATH="$PATH:$HOME/.local/bin" + fi +fi + +# Run the main install task +echo "⚙️ Running installation tasks..." +task install + +echo "" +echo "✅ Bootstrap complete!" +echo "" +echo "Next steps:" +echo " 1. Restart your shell or run: source ~/.zshrc" +echo " 2. Review and customize ~/.dotfiles/local/.localrc for machine-specific settings" +echo " 3. Set up your Git credentials if needed" +echo "" diff --git a/packages/git/gitconfig b/packages/git/gitconfig new file mode 100644 index 0000000..4962397 --- /dev/null +++ b/packages/git/gitconfig @@ -0,0 +1,159 @@ +[user] + # Set these in ~/.dotfiles/local/.localrc or directly edit here + # name = Your Name + # email = your.email@example.com + +[init] + defaultBranch = main + +[core] + editor = vim + autocrlf = input + excludesfile = ~/.gitignore_global + # Use pager for branch command + pager = less -FRX + +[color] + ui = auto + branch = auto + diff = auto + status = auto + +[color "branch"] + current = yellow reverse + local = yellow + remote = green + +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold + +[color "status"] + added = yellow + changed = green + untracked = cyan + +[alias] + # Basic shortcuts + st = status -sb + co = checkout + br = branch + ci = commit + unstage = reset HEAD -- + + # View abbreviated SHA, description, and history graph + l = log --pretty=oneline -n 20 --graph --abbrev-commit + lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit + + # Show verbose output about tags, branches or remotes + tags = tag -l + branches = branch -a + remotes = remote -v + + # Amend the currently staged files to the latest commit + amend = commit --amend --reuse-message=HEAD + + # Credit an author on the latest commit + credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" + + # Interactive rebase with the given number of latest commits + reb = "!r() { git rebase -i HEAD~$1; }; r" + + # Find branches containing commit + fb = "!f() { git branch -a --contains $1; }; f" + + # Find tags containing commit + ft = "!f() { git describe --always --contains $1; }; f" + + # Find commits by source code + fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" + + # Find commits by commit message + fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" + + # Remove branches that have already been merged with main + dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + + # List contributors with number of commits + contributors = shortlog --summary --numbered + + # Show the diff between the latest commit and the current state + d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" + + # Pull in remote changes for the current repository and all its submodules + p = pull --recurse-submodules + + # Clone a repository including all submodules + c = clone --recursive + + # Commit all changes + ca = !git add -A && git commit -av + + # Switch to a branch, creating it if necessary + go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" + + # Show the user email for the current repository + whoami = config user.email + + # Undo a `git push` + undopush = push -f origin HEAD^:master + +[apply] + # Detect whitespace errors when applying a patch + whitespace = fix + +[diff] + # Detect copies as well as renames + renames = copies + # Enable an experimental heuristic that makes the diff output more readable + indentHeuristic = true + +[diff "bin"] + # Use `hexdump` to diff binary files + textconv = hexdump -v -C + +[help] + # Automatically correct and execute mistyped commands + autocorrect = 1 + +[merge] + # Include summaries of merged commits in newly created merge commit messages + log = true + conflictstyle = diff3 + +[push] + # Push to the set upstream branch by default + default = simple + # Make `git push` push relevant annotated tags when pushing branches out + followTags = true + +[pull] + rebase = false + +[fetch] + prune = true + +[rebase] + autoStash = true + +[status] + showUntrackedFiles = all + +# URL shorthands +[url "git@github.com:"] + insteadOf = "gh:" + pushInsteadOf = "github:" + pushInsteadOf = "git://github.com/" + +[url "git://github.com/"] + insteadOf = "github:" + +[url "git@gist.github.com:"] + insteadOf = "gst:" + pushInsteadOf = "gist:" + pushInsteadOf = "git://gist.github.com/" + +[url "git://gist.github.com/"] + insteadOf = "gist:" diff --git a/path.bash b/path.bash index 62133cb..da5d4ec 100644 --- a/path.bash +++ b/path.bash @@ -9,4 +9,4 @@ export PATH=$PATH:$DOTFILES/bin # Local binary folders export PATH=$PATH:$DOTFILES/local/bin -eval "$(mise activate zsh)" +eval "$(mise activate bash)" diff --git a/tasks/symlink.yml b/tasks/symlink.yml index 34078a6..58b9a8c 100644 --- a/tasks/symlink.yml +++ b/tasks/symlink.yml @@ -50,6 +50,7 @@ tasks: - "packages/tmux/tmux.conf.symlink|$HOME/.tmux.conf" - "packages/zsh/zshrc|$HOME/.zshrc" - "packages/vim/vimrc|$HOME/.vimrc" + - "packages/git/gitconfig|$HOME/.gitconfig" - "packages/starship/config.toml|$HOME/.starship/config.toml" - "packages/mise/config.toml|$HOME/.config/mise.toml"