diff --git a/.bashrc b/.bashrc deleted file mode 100644 index 33cb4b6..0000000 --- a/.bashrc +++ /dev/null @@ -1 +0,0 @@ -[ -n "$PS1" ] && source ~/.bash_profile diff --git a/.freshrc b/.freshrc index 15d4ed5..cc9c923 100644 --- a/.freshrc +++ b/.freshrc @@ -1,179 +1,59 @@ # freshshell.com -# -# Examples: -# -# fresh twe4ked/dotfiles shell/functions.sh -# fresh jasoncodes/dotfiles aliases/rails.sh -# fresh jasoncodes/dotfiles config/tmux.conf --file -# -# See http://freshshell.com/readme for documentation. +# Zsh-focused dotfiles configuration # Meta: handles updating fresh fresh freshshell/fresh bin/fresh --bin -### ~/.bash_profile internals +# ============================================================ +# Shell configs (symlinked to ~/) +# ============================================================ +fresh shell/exports.sh --file=~/.exports +fresh shell/path.sh --file=~/.path +fresh shell/aliases.sh --file=~/.aliases +fresh shell/functions.sh --file=~/.functions -# inspired by mathiasbynens/dotfiles +# Zsh config +fresh zsh/.zshrc --file -# this `fresh` code symlinks each listed dotfile to ~/.$dotfile -# linked files are then source`d in ~/.bash_profile constructed below -for dotfile in path exports aliases functions; do - fresh bash/$dotfile.bash --file=~/.$dotfile -done -unset dotfile - -# construct ~/.bash_prompt -fresh-options --file=~/.bash_prompt - # bash-it theme: doubletime with custom extension - # load colors, base prompt setup - fresh Bash-it/bash-it themes/colors.theme.bash - fresh Bash-it/bash-it themes/base.theme.bash - fresh Bash-it/bash-it themes/githelpers.theme.bash - # Original - fresh Bash-it/bash-it themes/doubletime/doubletime.theme.bash - # Customizations based on Bash-It theme - fresh bash/doubletime.setup.bash -fresh-options - -### end ~/.bash_profile setup - -### CONFIG FILE LINKING -# Alternatively, copy manually along with this file, -# instead of symlinking with fresh. -# Comment out the lines below. -### -fresh-options --file=~/.bash_profile -# composure shell scripting - fresh erichs/composure composure.sh - # Start with some simple defaults. - fresh bash/profile.start.bash - fresh bash/bash-it-cite.bash - fresh Bash-it/bash-it lib/helpers.bash - # loads path,bash_prompt,exports,aliases,functions,extra - fresh bash/mathias.dotfiles.bash - - # source fresh's output - fresh freshshell/fresh contrib/source-build.sh - - # nvm sourced in functions; now we can set it up. - fresh bash/nvm-setup.bash - # theme obscures working dir from terminal; this fixes it - # e.g. new tab opens in same (current) directory - fresh bash/apple.terminal.working-dir.bash -fresh-options - -# .bashrc delegates to .bash_profile -fresh .bashrc --file - -# .inputrc for bash / readline config -fresh .inputrc --file +# GNU ls dircolors +fresh shell/dircolors.sh +fresh seebi/dircolors-solarized dircolors.ansi-universal --file=~/.dircolors -# gitconfig -fresh-options --file=~/.gitconfig - fresh .gituserconfig - fresh .gitconfig +# ============================================================ +# Git +# ============================================================ +fresh-options --file=gitconfig + fresh git/.gituserconfig + fresh git/.gitconfig fresh-options -fresh .gitattributes --file -fresh .gitignore --file +fresh git/.gitattributes --file +fresh git/.gitignore --file -# tmux +# ============================================================ +# Tmux +# ============================================================ fresh-options --file=~/.tmux.conf - if [[ "$(uname)" == "Darwin" ]]; then - fresh tmux/.tmux.macOS.conf - fi - fresh seebi/tmux-colors-solarized tmuxcolors-dark.conf -fresh-options - -# emacs -fresh-options --file=~/.emacs.d/init.el - fresh emacs/init.el + fresh tmux/.tmux.conf + fresh seebi/tmux-colors-solarized tmuxcolors-dark.conf fresh-options -### end config file linking +# ============================================================ +# Emacs +# ============================================================ +# fresh emacs/init.el --file=~/.emacs.d/init.el -# dircolors -fresh bash/dircolors.bash - -# fasd init (source'd) -# this provides the aliases -# & data from a cached init code -# to keep things speedy -fresh bash/fasd.setup.bash - -# https://github.com/nvbn/thefuck -fresh bash/thefuck.sh - -# brew command-not-found -fresh bash/command-not-found.bash +# ============================================================ +# Readline (still useful for other programs) +# ============================================================ +fresh .inputrc --file -### BIN management +# ============================================================ +# Starship +# ============================================================ +fresh starship/starship.toml --file=~/.config/starship.toml -# Re-install fresh with bootstrap +# ============================================================ +# Bin scripts +# ============================================================ fresh install.sh --bin=~/bin/dotfiles - -# git friendly -# abstractions around common git tasks -for gitHelper in branch merge pull push; do - fresh jamiew/git-friendly $gitHelper --bin -done -unset gitHelper - -# FASD -# autojump, z util for directory jumping sorted by "frecency" -fresh clvv/fasd fasd --bin - -# Leiningen Clojure Build System -# awesome way to bootstrap Clojure. -# there's a `brew` for it but whatevs. -# needs Java installed (JDK) -fresh technomancy/leiningen bin/lein --bin --ref=origin/stable - -# Leiningen-Powered Clojure Scripting -fresh kumarshantanu/lein-exec lein-exec --bin -fresh kumarshantanu/lein-exec lein-exec-p --bin - -# todo.txt: simple todo list -fresh ginatrapani/todo.txt-cli todo.sh --bin=~/bin/todo -# store todos in dropbox for effortless syncing -fresh todo.cfg --file=~/.todo/config - -# Cross-Origin --disable-web-security Chrome with clean slate -fresh bin/crossOriginChrome.sh --bin - -### completions - -fresh autocompletion/local.sh -# local completions -# brew git git-flow etc. -# Homebrew: Mac OS X package management (used to download most everything else listed here) -# git Source Control Management -# git flow - Toolkit for Higher Level Branching abstractions - -# bash-it completions -# gem pip ssh todo -# Ruby gems -# pip Python Package Management -# ssh completion with allowed hosts -# todo.txt cli -for completion in gem pip ssh todo; do - fresh Bash-it/bash-it completion/available/$completion.completion.bash -done -unset completion - -# GNU ls dircolors -fresh seebi/dircolors-solarized dircolors.ansi-universal --file=~/.dircolors - -# fresh completion (how meta) -fresh freshshell/fresh contrib/completion/fresh-completion.bash - -# apex -fresh autocompletion/apex.sh - -# git-friendly -fresh autocompletion/git-friendly.sh - -# vault -fresh autocompletion/vault.sh - -### end completions diff --git a/2026_REFRESH.md b/2026_REFRESH.md new file mode 100644 index 0000000..d8e8514 --- /dev/null +++ b/2026_REFRESH.md @@ -0,0 +1,133 @@ +# 2026 Dotfiles Refresh + +## Why + +macOS switched to zsh as the default shell in Catalina (2019). These dotfiles were +originally bash-focused using Bash-It framework. Time to modernize. + +## Future Plans + +### mise - Polyglot Version Manager +Replace nvm (and rvm, pyenv, etc.) with [mise](https://mise.jdx.dev/): +- Single tool for Node, Ruby, Python, Go, Java, etc. +- Faster than nvm (no shell startup penalty) +- Compatible with `.nvmrc`, `.node-version`, `.ruby-version` +- Configuration in `~/.config/mise/config.toml` + +```bash +brew install mise +# In .zshrc: eval "$(mise activate zsh)" +``` + +### GNU Stow - Simpler Symlink Management +Consider replacing Fresh with [GNU Stow](https://www.gnu.org/software/stow/): +- Simpler mental model (directories mirror `~/`) +- No build step - what you see is what you link +- Widely used in dotfiles community +- Each "package" is a directory that gets symlinked + +```bash +brew install stow +cd ~/.dotfiles +stow zsh shell git tmux # Creates symlinks to ~/ +``` + +### Other Considerations +- **zsh-autosuggestions** - Fish-like suggestions as you type +- **zsh-syntax-highlighting** - Command highlighting + +--- + +## What Changed + +### Shell: bash → zsh +- Primary config: `~/.zshrc` (was `~/.bash_profile`) +- History: `~/.zsh_history` with zsh-specific options +- Completions: Native zsh completion system + +### Architecture: Intel → Apple Silicon +- Homebrew location: `/opt/homebrew` (was `/usr/local`) +- Universal path handling for both architectures + +### Directory Structure +``` +bash/ → shell/ # Shell-agnostic configs +├── exports.bash ├── exports.sh +├── path.bash ├── path.sh +├── aliases.bash ├── aliases.sh +└── functions.bash └── functions.sh +``` + +Old bash-specific files removed (git history preserved). + +### Tools Replaced + +| Old | New | Why | +|-----|-----|-----| +| Bash-It themes | Starship | Cross-shell, fast, configurable | +| fasd | zoxide | Faster, maintained, better algorithm | +| hub | gh | Official GitHub CLI | +| reattach-to-user-namespace | (removed) | Not needed since tmux 2.6 | +| Python 2 http.server | Python 3 | Python 2 EOL | + +### Tools Added + +| Tool | Purpose | +|------|---------| +| bat | Better cat with syntax highlighting | +| fd | Better find | +| ripgrep (rg) | Better grep | +| fzf | Fuzzy finder | +| git-delta | Better git diff | + +### Brewfile Pared Down + +Removed deprecated packages and trimmed to essentials: +- `boot2docker`, `docker-machine`, `fig` (old Docker tooling) +- `reattach-to-user-namespace` (tmux workaround) +- `mongodb` with args (needs tap now) +- `lighttable`, `lightpaper` (discontinued editors) +- `growl` (deprecated) +- Old cask tap names (`caskroom/*` → `homebrew/*`) + +## Configuration + +### Fresh Shell Manager + +Still using [Fresh](http://freshshell.com/) for symlink management. Updated `.freshrc` +to build zsh configs instead of bash. + +Fresh builds: +- `~/.zshrc` ← `zsh/.zshrc` +- `~/.exports` ← `shell/exports.sh` +- `~/.path` ← `shell/path.sh` +- `~/.aliases` ← `shell/aliases.sh` +- `~/.functions` ← `shell/functions.sh` +- `~/.config/starship.toml` ← `starship/starship.toml` +- `~/.gitconfig` ← `git/.gitconfig` + `git/.gituserconfig` +- `~/.tmux.conf` ← `tmux/.tmux.conf` + solarized colors +- `~/.dircolors` ← seebi/dircolors-solarized + +### Git Config + +Uses `include.path` to allow `git config --global` while preserving Fresh defaults. +Set up by `install.sh`. + +## Installation + +```bash +git clone https://github.com/simshanith/dotfiles.git ~/.dotfiles +cd ~/.dotfiles +./install.sh +exec zsh +``` + +## Verification + +```bash +echo $SHELL # /bin/zsh +which brew # /opt/homebrew/bin/brew +starship --version # Prompt +zoxide --version # Directory jumping +fresh # No errors +``` diff --git a/Brewfile b/Brewfile index b7e1512..4be73de 100644 --- a/Brewfile +++ b/Brewfile @@ -1,128 +1,64 @@ -# Brewfile, powered by Homebrew Bundle. -# https://robots.thoughtbot.com/brewfile-a-gemfile-but-for-homebrew -# https://github.com/Homebrew/homebrew-bundle - -# Install as a tap: -# `brew tap homebrew/bundle` -# Install everything listed here: -# `brew bundle` - -# Meta, for maintaining whitelist. -tap 'homebrew/bundle' -# systemd-esque services -tap 'homebrew/services' -# missing command helper -tap 'homebrew/command-not-found' - -# `brew bundle cleanup --dry-run` -# outputs formulae not listed here. - -# CLI tools. -brew 'ack' -brew 'bash' -brew 'curl' -brew 'coreutils' -brew 'emacs' -brew 'heroku' -brew 'reattach-to-user-namespace' -brew 'thefuck' -brew 'tmux' -brew 'tree' -brew 'wget' -brew 'yarn' - -# VCS. -brew 'git', args: ['with-brewed-curl', 'with-brewed-openssl', 'with-brewed-svn', 'with-gettext', 'with-pcre', 'with-persistent-https'] -brew 'git-flow' -brew 'gibo' -brew 'hub' -brew 'legit' -brew 'subversion', args: ['with-perl'] -brew 'tig' - -# Languages. -brew 'go' -brew 'python' -brew 'ruby' -brew 'node' - -# Virtual Machines -brew 'docker' -brew 'docker-machine' -brew 'boot2docker' -brew 'fig' -brew 'docker-compose' - -# Databases -brew 'mongodb', args: ['with-openssl'] -brew 'redis' -brew 'mysql' -brew 'postgresql' - -# Misc. -brew 'd-bus' -brew 'flow' -brew 'jq' -brew 'fortune' -brew 'cowsay' -brew 'mas' - -# Dependencies for above. -# While redundant; nice to have whitelisted. -brew 'gdbm' -brew 'gettext' -brew 'libyaml' -brew 'openssl' -brew 'pcre' -brew 'pkg-config' -brew 'readline' -brew 'scons' -brew 'sqlite' -brew 'swig' - -# ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- - -# Casks. -# http://caskroom.io/ - -tap 'caskroom/cask' -tap 'caskroom/versions' -tap 'caskroom/fonts' +# Brewfile +# Install: brew bundle +# Cleanup: brew bundle cleanup --force +tap "d12frosted/emacs-plus" +tap "oven-sh/bun" + +# Shell +brew "bash" +brew "zsh" +brew "zsh-history-substring-search" +brew "starship" + +# Modern CLI +brew "bat" +brew "fd" +brew "fzf" +brew "ripgrep" +brew "zoxide" +brew "jq" +brew "tree" + +# Core utilities +brew "coreutils" +brew "gnu-sed" +brew "grep" +brew "ssh-copy-id" + +# Git +brew "git" +brew "git-delta" +brew "gh" +brew "tig" +brew "gibo" + +# Editors +brew "emacs-plus@30" + +# Terminal +brew "tmux" + +# Languages +brew "bun" +brew "go" +brew "python" +brew "rust" + +# Misc +brew "thefuck" +brew "fortune" +brew "cowsay" +brew "lolcat" +brew "sox" + +# Casks +cask "1password" +cask "1password-cli" +cask "ghostty" +cask "google-chrome" +cask "iterm2" +cask "localsend" +cask "tailscale-app" # Fonts -cask 'caskroom/fonts/font-dejavu-sans' - -# Browsers. -cask 'firefox' -cask 'google-chrome' - -# Editors. -cask 'sublime-text' -cask 'lighttable' -cask 'lightpaper' - -# Music. -cask 'lastfm' -cask 'spotify' - -# Virtual Machines -cask 'virtualbox' -cask 'vagrant' - -# Misc. -cask 'bartender' -cask 'xquartz' - -# Mac App Store -mas "Amphetamine", id: 937984704 -mas "BetterSnapTool", id: 417375580 -mas "Gapplin", id: 768053424 -mas "GarageBand", id: 682658836 -mas "Growl", id: 467939042 -mas "iMovie", id: 408981434 -mas "Keynote", id: 409183694 -mas "LastPass", id: 926036361 -mas "Numbers", id: 409203825 -mas "Pages", id: 409201541 -mas "The Unarchiver", id: 425424353 -mas "Xcode", id: 497799835 +cask "font-symbols-only-nerd-font" diff --git a/autocompletion/apex.sh b/autocompletion/apex.sh deleted file mode 100644 index 5a0706c..0000000 --- a/autocompletion/apex.sh +++ /dev/null @@ -1,9 +0,0 @@ -_apex() { - COMPREPLY=() - local cur="${COMP_WORDS[COMP_CWORD]}" - local opts="$(apex autocomplete -- ${COMP_WORDS[@]:1})" - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 -} - -complete -F _apex apex diff --git a/autocompletion/git-friendly.sh b/autocompletion/git-friendly.sh deleted file mode 100644 index 927a033..0000000 --- a/autocompletion/git-friendly.sh +++ /dev/null @@ -1,13 +0,0 @@ -if type __git_complete &> /dev/null; then - _branch () { - delete="${words[1]}" - if [ "$delete" == "-d" ] || [ "$delete" == "-D" ]; then - _git_branch - else - _git_checkout - fi - } - - __git_complete branch _branch - __git_complete merge _git_merge -fi; diff --git a/autocompletion/local.sh b/autocompletion/local.sh deleted file mode 100644 index 49c21a6..0000000 --- a/autocompletion/local.sh +++ /dev/null @@ -1,7 +0,0 @@ -[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion - -if [[ -d "/usr/local/etc/bash_completion.d/" ]]; then - for f in /usr/local/etc/bash_completion.d/*; do - source $f; - done -fi diff --git a/autocompletion/vault.sh b/autocompletion/vault.sh deleted file mode 100644 index ce730b0..0000000 --- a/autocompletion/vault.sh +++ /dev/null @@ -1,3 +0,0 @@ -if [[ -x "/usr/local/bin/vault" ]]; then - complete -C /usr/local/bin/vault vault -fi diff --git a/bash/aliases.bash b/bash/aliases.bash deleted file mode 100644 index c9b3def..0000000 --- a/bash/aliases.bash +++ /dev/null @@ -1,90 +0,0 @@ -if hash gls 2>/dev/null ; then - if [[ "$(uname)" == "Darwin" ]]; then - alias ls="gls --color=auto -p -F" - else - alias ls="ls --color=auto -p -F" - fi -else - alias ls="ls -GFH" -fi - -alias la="ls -A" -alias ll="ls -lHh" -alias lla="ll -A" -alias all="lla" - - -# less & grep with ANSI colors -alias less='less --RAW-CONTROL-CHARS' -alias more='more --RAW-CONTROL-CHARS' -alias grep='grep --color=auto' -# be nice -alias please=sudo -alias hosts='please $EDITOR /etc/hosts' - -# folder jumpin -alias ..='cd ..' # Go up one directory -alias ...='cd ../..' # Go up two directories -alias ....='cd ../../..' # Go up three directories -alias -- -='cd -' # Go back - -# File editing -# ~/bin/subl (set in exports) -alias subl="subl -w" -alias bgsubl="forever start -m 1 -c subl" -alias edit="subl" - -# git hub -# http://hub.github.com/ -# alias git=hub - -# fasd shortcuts -alias fe="f -e $EDITOR" -alias ae="a -e $EDITOR" -alias se="s -e $EDITOR" -alias de="d -e $EDITOR" -# interactive mode: display list then open with editor -alias fei="f -i -e $EDITOR" -alias aei="a -i -e $EDITOR" -alias sei="s -i -e $EDITOR" -alias dei="d -i -e $EDITOR" - -alias fie="fei" -alias aie="aei" -alias sie="sei" -alias die="dei" - -alias emacs="TERM=xterm-256color emacs --no-splash -nw" - -# Use GNU readlink to determine absolute filepaths -alias realpath='greadlink -f' - -# alias "http" to python SimpleHTTPServer function -alias http='server' - -# alias "jsontool" to json.tool -alias jsontool='python -m json.tool' - -# alias md to marked (node markdown parser) -alias md='marked --smart-lists' - -# alias mou to Mou app -alias mou='open -a Mou' - -# alias nw to node-webkit app -# alias nw='~/Applications/node-webkit.app/Contents/MacOS/node-webkit' - -# alias t to todo.txt CLI -alias t='todo' - -# https://github.com/paulirish/dotfiles/blob/master/.aliases -# `cat` with beautiful colors. requires Pygments installed. -alias c='pygmentize -O style=solarized-dark -f console256 -g' - -# http://xkcd.com/530/ -alias stfu="osascript -e 'set volume output muted true'" -alias pumpitup="osascript -e 'set volume 10'" -alias hax="growl '31337 hax WTF'; eightbit;" - -# open all merge conflicts or currently changed files in sublime text -alias fixchanges="git diff --name-only | uniq | xargs subl" diff --git a/bash/apple.terminal.working-dir.bash b/bash/apple.terminal.working-dir.bash deleted file mode 100644 index 9849e51..0000000 --- a/bash/apple.terminal.working-dir.bash +++ /dev/null @@ -1,14 +0,0 @@ -# This goes at the bottom of the .bash_profile. -# Tell the terminal about the working directory at each prompt. -if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then - update_terminal_cwd() { - # Identify the directory using a "file:" scheme URL, - # including the host name to disambiguate local vs. - # remote connections. Percent-escape spaces. - local SEARCH=' ' - local REPLACE='%20' - local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" - printf '\e]7;%s\a' "$PWD_URL" - } - PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND" -fi diff --git a/bash/bash-it-cite.bash b/bash/bash-it-cite.bash deleted file mode 100644 index f74e735..0000000 --- a/bash/bash-it-cite.bash +++ /dev/null @@ -1 +0,0 @@ -cite _about _param _example _group _author _version diff --git a/bash/command-not-found.bash b/bash/command-not-found.bash deleted file mode 100644 index eecbc0b..0000000 --- a/bash/command-not-found.bash +++ /dev/null @@ -1 +0,0 @@ -if brew command command-not-found-init > /dev/null 2>&1; then eval "$(brew command-not-found-init)"; fi diff --git a/bash/dircolors.bash b/bash/dircolors.bash deleted file mode 100644 index 8a2ce58..0000000 --- a/bash/dircolors.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# requires GNU `dircolors` + `ls` -# `brew install coreutils` - -# https://github.com/seebi/dircolors-solarized -if [[ -x "$(command -v gdircolors)" ]]; then - eval `gdircolors ~/.dircolors` -elif [[ -x "$(command -v dircolors)" ]]; then - eval `dircolors ~/.dircolors` -fi diff --git a/bash/doubletime.setup.bash b/bash/doubletime.setup.bash deleted file mode 100644 index 847a9b6..0000000 --- a/bash/doubletime.setup.bash +++ /dev/null @@ -1,65 +0,0 @@ -# Use FQDN -THEME_PROMPT_HOST="$(hostname -f)" - -# include svn status information -sim_scm_prompt() { - scm - local sim_scm_prompt_prefix - sim_scm_prompt_prefix="$background_cyan $normal ${blue}$SCM${normal}" - if [ "$SCM" == "$SCM_NONE" ]; then - echo - return - elif [ "$SCM" == "$SCM_GIT" ]; then - echo "$sim_scm_prompt_prefix $(git_prompt_status)\n" - elif [ "$SCM" == "$SCM_SVN" ]; then - echo "$sim_scm_prompt_prefix $(svn_prompt_status)\n" - else - echo "$sim_scm_prompt_prefix [$(scm_prompt_info)]\n" - fi -} - -svn_prompt_status() { - echo -} - -itermMark() { - if [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && [[ $(type -t iterm2_prompt_mark) == 'function' ]] - then - echo "\[$(iterm2_prompt_mark)\]" - fi -} - -# override bash-it echo -e with unescaped version -function scm_char { - scm_prompt_char - echo "$SCM_CHAR" -} - -function prompt_setter() { - # Save history - history -a - history -c - history -r - if [[ -z "$THEME_PROMPT_CLOCK_FORMAT" ]] - then - clock="\t" - else - clock="$THEME_PROMPT_CLOCK_FORMAT" - fi - - if [[ -z "$SSH_CLIENT" ]] - then - ssh_prompt="" - else - ssh_prompt="${bold_white}${background_cyan} ssh ${normal}" - fi - PS1="\n${bold_white}${background_blue} ${clock} ${normal} $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}${normal}] -$ssh_prompt${black}${background_white} \w ${normal}\n$(sim_scm_prompt)$(itermMark)${bold_white}${background_orange} λ ${normal} " - PS2='> ' - PS4='+ ' -} - -export history_command='history -a;' -history_command='history -a; echo "$$ $USER $(history 1)" >> ~/.bash_eternal_history' - -PROMPT_COMMAND="prompt_setter; $history_command" diff --git a/bash/exports.bash b/bash/exports.bash deleted file mode 100644 index ec68706..0000000 --- a/bash/exports.bash +++ /dev/null @@ -1,53 +0,0 @@ -# awesome history tracking -export HISTSIZE=100000 -export HISTFILESIZE=100000 -export HISTCONTROL=ignoredups -export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " - -# Don’t clear the screen after quitting a manual page -export MANPAGER="less -X" - -if [[ "$(uname)" == "Darwin" ]]; then - - # declare brew bash as shell - export SHELL="/usr/local/bin/bash" - - # Your place for hosting Git repos. I use this for private repos. - export GIT_HOSTING='git@bitbucket.org' - - # Java - export JAVA_HOME=`/usr/libexec/java_home -v 13` - # Maven from brew - export MAVEN_HOME="/usr/local/Cellar/maven/3.3.9/libexec" - - # Set my editor and git editor - export EDITOR="subl -w" - export GIT_EDITOR="subl -w" - export SVN_EDITOR="subl -w" - # GNU Emacs GUI - export EMACS_APP="/Applications/Emacs.app/Contents/MacOS/Emacs" - - # Handy Dropbox reference. - export DROPBOX="$HOME/Dropbox" - - # Golang - export GOPATH="$HOME/golang" - export GOBIN="$GOPATH/bin" - - # Globally install apps with homebrew cask - export HOMEBREW_CASK_OPTS="--appdir=/Applications" - - # Google Chrome via Caskroom. - export CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" - - # Firefox via Caskroom (for SlimerJS) - export SLIMERJSLAUNCHER="/Applications/Firefox.app/Contents/MacOS/firefox" - - - # pkg-config for node-canvas et al. - # - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig - -fi - -export SIM_DOTFILES_SETUP='oooohyeah' \ No newline at end of file diff --git a/bash/fasd.setup.bash b/bash/fasd.setup.bash deleted file mode 100644 index 24254d5..0000000 --- a/bash/fasd.setup.bash +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -fasd_cache="$HOME/.fasd-init-bash" -if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then - fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache" -fi -source "$fasd_cache" -unset fasd_cache diff --git a/bash/functions.bash b/bash/functions.bash deleted file mode 100644 index 3086c93..0000000 --- a/bash/functions.bash +++ /dev/null @@ -1,124 +0,0 @@ -# http://kmkeen.com/awk-music/ -eightbit() { - awk 'function wl() { - rate=64000; - return (rate/160)*(0.87055^(int(rand()*10)))}; - BEGIN { - srand(); - wla=wl(); - while(1) { - wlb=wla; - wla=wl(); - if (wla==wlb) - {wla*=2;}; - d=(rand()*10+5)*rate/4; - a=b=0; c=128; - ca=40/wla; cb=20/wlb; - de=rate/10; di=0; - for (i=0;iwla) - {a=0; ca*=-1}; - if (b>wlb) - {b=0; cb*=-1}; - if (di>de) - {di=0; ca*=0.9; cb*=0.9}; - printf("%c",c)}; - c=int(c); - while(c!=128) { - c<128?c++:c--; - printf("%c",c)};};}' | - sox -t raw -r 64k -c 1 -e unsigned -b 8 - -d -} - - -# pipe markdown to screen as pretty-printed, syntax highlighted HTML -markdown() { - pd mode:"beautify" readmethod:"screen" source:"`md $1`" | - pygmentize -l html -} - - -# html css js csv beautification via prettydiff -beautify() { - local SOURCE=`realpath "$1"` - [ -r "$SOURCE" ] && pd mode:'beautify' readmethod:'filescreen' source:"$SOURCE" -} - -# Change directory to the current Finder directory -# http://apple.stackexchange.com/a/96810/52388 -cdf() { - target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` - if [ "$target" != "" ]; then - cd "$target"; pwd - else - echo 'No Finder window found' >&2 - fi -} - -# Create a new directory and enter it -function mkd() { - mkdir -p "$@" && cd "$@" -} - -### iTerm2 utils -if [[ "$TERM_PROGRAM" == 'iTerm.app' ]] -then - nametab () { - if [ -z "$1" ]; then - echo "Usage:" - echo "\`nametab workspace\`" - echo "Sets the tab's namespace in iTerm using escape sequence." - else - echo -e $'\033];'${*}'\007' ; return ; - fi - } - - # send growl messages - # http://aming-blog.blogspot.com/2011/01/growl-notification-from-iterm-2.html - # requires growl http://growl.info/ - growl() { echo -e $'\e]9;'${*}'\007' ; return ; } -fi - -# http://xkcd.com/530/ -hello () { - osascript -e 'say "Hello '$1'"'; -} - -# git log with per-commit cmd-clickable GitHub URLs (iTerm) -function gf() { - local remote="$(git remote -v | awk '/^origin.*\(push\)$/ {print $2}')" - [[ "$remote" ]] || return - local user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')" - git log $* --name-status --color | awk "$(cat < /dev/null && ps2pdf - - || cat) | - open -f -a /Applications/Preview.app - } -fi - -λ () { - fortune | cowsay -f tux -W 50 | lolcat -p 2 -} - -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* diff --git a/bash/mathias.dotfiles.bash b/bash/mathias.dotfiles.bash deleted file mode 100644 index 35012b1..0000000 --- a/bash/mathias.dotfiles.bash +++ /dev/null @@ -1,9 +0,0 @@ -# Load the shell dotfiles, and then some: -# * ~/.path can be used to extend `$PATH`. -# * ~/.extra can be used for other settings you don’t want to commit. - -# These are symlinked with fresh. -for file in ~/.{exports,path,aliases,functions,bash_prompt,extra,iterm2_shell_integration.bash}; do - [ -r "$file" ] && source "$file" -done -unset file diff --git a/bash/nvm-setup.bash b/bash/nvm-setup.bash deleted file mode 100644 index 1526218..0000000 --- a/bash/nvm-setup.bash +++ /dev/null @@ -1,3 +0,0 @@ -# Load nvm into a shell session *as a function* -[[ -s $HOME/.nvm/nvm.sh ]] && source $HOME/.nvm/nvm.sh -nvm use default --silent; diff --git a/bash/path.bash b/bash/path.bash deleted file mode 100644 index b0b73d9..0000000 --- a/bash/path.bash +++ /dev/null @@ -1,24 +0,0 @@ -if [[ "$(uname)" == "Darwin" ]]; then - ### Heroku Toolbelt - PATH="/usr/local/heroku/bin:$PATH" - - # Adobe Flex SDK - # PATH="~/Code/flex_sdk_4.6/bin:$PATH" - - # Ensure /usr/local/bin before /usr/bin for Homebrew - PATH="/usr/local/bin:/usr/local/sbin:$PATH" - - # Golang - PATH="${GOPATH//://bin:}/bin:$PATH" - - # AEM stuffs - PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH" -fi - -# Put ~/bin before everything -PATH="$HOME/bin:$PATH" - -# Add RVM to PATH for scripting. -PATH="$PATH:$HOME/.rvm/bin" - -export PATH diff --git a/bash/profile.start.bash b/bash/profile.start.bash deleted file mode 100644 index 0999c73..0000000 --- a/bash/profile.start.bash +++ /dev/null @@ -1,12 +0,0 @@ -# Don't check mail when opening terminal. -unset MAILCHECK - -# Enable some Bash 4 features when possible: -# * Recursive globbing, e.g. `echo **/*.txt` -shopt -s globstar 2> /dev/null - -shopt -s histappend - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize diff --git a/bash/thefuck.sh b/bash/thefuck.sh deleted file mode 100644 index 5db4916..0000000 --- a/bash/thefuck.sh +++ /dev/null @@ -1,3 +0,0 @@ -if [ -x "$(command -v thefuck)" ]; then - eval "$(thefuck --alias)" -fi diff --git a/bower.json b/bower.json deleted file mode 100644 index 77b7adc..0000000 --- a/bower.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "sim dotfiles", - "version": "0.1.0", - "dependencies": { - "jquery": "git://github.com/components/jquery.git#1.11", - "jquery-legacy": "git://github.com/components/jquery.git#1.11", - "jquery-modern": "git://github.com/components/jquery.git#2", - "q": "git://github.com/kriskowal/q.git#~1.0.1", - "jquery.transit": "git://github.com/rstacruz/jquery.transit.git#~0.9.12", - "jquery-touchswipe": "git://github.com/mattbryson/TouchSwipe-Jquery-Plugin.git#~1.6.6", - "typeahead.js": "~0.10.5", - "lodash": "~2.4.1", - "backbone": "~1.1.2", - "underscore": "~1.7.0", - "modernizr": "~2.8.3", - "handlebars": "~2.0.0", - "dragdealer": "skidding/dragdealer", - "jquery.cookie": "~1.4.1", - "swipe": "~2.0.0", - "underscore-contrib": "~0.3.0", - "underscore.string": "~2.3.3", - "chosen": "~1.4.2", - "imagesloaded": "~3.1.8", - "verge": "~1.9.1", - "jquery.scrollTo": "~1.4.13", - "screenfull": "~1.2.1", - "angular": "~1.3.1", - "platform": "Polymer/platform#~0.4.2", - "polymer": "Polymer/polymer#~0.4.2", - "polymer-elements": "Polymer/polymer-elements#~0.3.0", - "polymer-ui-elements": "Polymer/polymer-ui-elements#~0.3.0", - "react": "~0.12.0", - "mori": "~0.2.9", - "yepnope": "~2.0.0", - "jade": "~1.7.0", - "webshim": "~1.15.3", - "jquery-hammerjs": "hammerjs/jquery.hammer.js", - "hammerjs": "~2.0.4", - "silent-console": "~0.3.1" - }, - "resolutions": { - "jquery": "~1.11.1", - "underscore": "~1.5.1", - "polymer": "~0.4.2", - "core-component-page": "^0.4.0" - }, - "devDependencies": { - "threesixty-slider": "*" - } -} diff --git a/.gitattributes b/git/.gitattributes similarity index 100% rename from .gitattributes rename to git/.gitattributes diff --git a/.gitconfig b/git/.gitconfig similarity index 93% rename from .gitconfig rename to git/.gitconfig index 4854745..2f57847 100644 --- a/.gitconfig +++ b/git/.gitconfig @@ -4,6 +4,8 @@ [color] ui = always diff = true +[init] + defaultBranch = main [url "git@github.com:"] insteadOf = "gh:" pushInsteadOf = "github:" @@ -25,6 +27,7 @@ [push] default = simple + autoSetupRemote = true [diff] algorithm = patience @@ -93,10 +96,10 @@ grep = grep -Ii gr = grep -Ii #grep from root folder - gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f" + gra = grep --full-name -In :/ #grep on filename - f = "!git ls-files | grep -i" + f = "!git ls-files | rg -i" #rename branch tree to done- done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f" @@ -105,7 +108,7 @@ assume = update-index --assume-unchanged unassume = update-index --no-assume-unchanged #show assumed files - assumed = "!git ls-files -v | grep ^h | cut -c 3-" + assumed = "!git ls-files -v | rg '^h' | cut -c 3-" #unassume all the assumed files unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged" assumeall = "!git st -s | awk {'print $2'} | xargs git assume" diff --git a/.gitignore b/git/.gitignore similarity index 93% rename from .gitignore rename to git/.gitignore index f85958d..3f3c47c 100644 --- a/.gitignore +++ b/git/.gitignore @@ -26,3 +26,5 @@ Icon # SublimeText project files *.sublime-workspace + +.claude/settings.local.json diff --git a/install.sh b/install.sh index 70cd7a6..b72c17f 100755 --- a/install.sh +++ b/install.sh @@ -1,47 +1,83 @@ -#!/usr/bin/env bash +#!/bin/bash +# Dotfiles bootstrap script +# Assumes: macOS, Apple Silicon, zsh +set -euo pipefail -# bootstrap the configuration -# requires git +DOTFILES="${DOTFILES:-$HOME/.dotfiles}" +echo "=== Dotfiles Installation ===" +echo "Source: $DOTFILES" -# backup configs -for dotfile in ~/.{bash_profile,bashrc,freshrc,gitconfig,tmux.conf}; do - [ -r "$dotfile" ] && mv -vf $dotfile ~/.dotfiles/backups/ -done -unset dotfile +# Homebrew +if ! command -v brew &>/dev/null; then + echo "Installing Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + eval "$(/opt/homebrew/bin/brew shellenv)" +fi -# copy .freshrc to ~ -cp -vf ~/.dotfiles/.freshrc ~ +# Packages +echo "Installing packages..." +brew bundle --file="$DOTFILES/Brewfile" || true + +# Backup existing configs +backup_dir="$DOTFILES/backups/$(date +%Y%m%d_%H%M%S)" +mkdir -p "$backup_dir" +for f in .zshrc .exports .path .aliases .functions .tmux.conf .inputrc; do + if [[ -f "$HOME/$f" && ! -L "$HOME/$f" ]]; then + echo "Backing up ~/$f" + mv "$HOME/$f" "$backup_dir/" + fi +done -# copy bin/symlinks to ~/bin -if [[ "$(uname)" == "Darwin" ]]; then - cp -R ~/.dotfiles/bin/symlinks/* ~/bin/ +# Backup starship config if it exists +if [[ -f "$HOME/.config/starship.toml" && ! -L "$HOME/.config/starship.toml" ]]; then + echo "Backing up ~/.config/starship.toml" + mv "$HOME/.config/starship.toml" "$backup_dir/" fi -if [ -e ~/.dotfiles/.gituserconfig ]; then - echo "Git user config already exists." -else - touch ~/.dotfiles/.gituserconfig - echo "### user specific settings" >> ~/.dotfiles/.gituserconfig - echo "### e.g." >> ~/.dotfiles/.gituserconfig - echo "# [user]" >> ~/.dotfiles/.gituserconfig - echo "# name = John Doe" >> ~/.dotfiles/.gituserconfig - echo "# email = jdoe@example.com" >> ~/.dotfiles/.gituserconfig - - echo "Git user config intialized. Please edit and re-run \`fresh\`." +# Create .gituserconfig if it doesn't exist +if [[ ! -e "$DOTFILES/git/.gituserconfig" ]]; then + cat > "$DOTFILES/git/.gituserconfig" << 'EOF' +# User-specific git settings (not committed to repo) +# Example: +# [user] +# name = John Doe +# email = jdoe@example.com +EOF + echo "Git user config initialized. Please edit $DOTFILES/git/.gituserconfig" fi -# install fresh or run for re-fresh -if [[ -z `which fresh` ]]; then - bash -c "`curl -sL get.freshshell.com`" +# Fresh shell manager +if [[ ! -d "$HOME/.fresh" ]]; then + echo "Installing Fresh..." + bash -c "$(curl -sL https://get.freshshell.com)" else - fresh + echo "Updating Fresh..." + fresh update || true fi -# source it -if [[ -z "$SIM_DOTFILES_SETUP" ]]; then - [ -r "~/.bash_profile" ] && source ~/.bash_profile +# Source fresh to make the command available +source "$HOME/.fresh/build/shell.sh" + +# Link configs +cp "$DOTFILES/.freshrc" "$HOME/.freshrc" +fresh install + +# Configure git to include fresh-managed defaults +# This allows git config --global to work while preserving fresh defaults +FRESH_GITCONFIG="$HOME/.fresh/build/gitconfig" +if [[ -f "$FRESH_GITCONFIG" ]]; then + if ! git config --global --get-all include.path 2>/dev/null | grep -qF "$FRESH_GITCONFIG"; then + echo "Configuring git to include fresh defaults..." + git config --global include.path "$FRESH_GITCONFIG" + fi fi -if [[ -n "$SIM_DOTFILES_SETUP" ]]; then - echo "All done! Your prompt should be updated and you are now using Fresh." +# iTerm2 shell integration +if [[ ! -f "$HOME/.iterm2_shell_integration.zsh" ]]; then + echo "Installing iTerm2 shell integration..." + curl -L https://iterm2.com/shell_integration/zsh -o "$HOME/.iterm2_shell_integration.zsh" fi + +echo "" +echo "=== Done! ===" +echo "Restart terminal or run: exec zsh" diff --git a/readme.md b/readme.md index c00a2d7..a38dd57 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,11 @@ +# dotfiles + +See [2026_REFRESH.md](./2026_REFRESH.md) for the current zsh-based setup. + +--- + +*The content below is kept for posterity.* + [dotfiles.github.io](http://dotfiles.github.io/) [freshshell.com](http://freshshell.com/) diff --git a/shell/aliases.sh b/shell/aliases.sh new file mode 100644 index 0000000..cadba34 --- /dev/null +++ b/shell/aliases.sh @@ -0,0 +1,69 @@ +# ~/.aliases +# Shell aliases + +# ============================================================ +# ls (GNU coreutils via Homebrew) +# ============================================================ +if command -v gls &>/dev/null; then + alias ls='gls --color=auto -p -F' +else + alias ls='ls -GFh' # macOS fallback +fi +alias la='ls -A' +alias ll='ls -lh' +alias lla='ll -A' +alias all='lla' + +# ============================================================ +# Navigation +# ============================================================ +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias -- -='cd -' + +# ============================================================ +# Color output +# ============================================================ +alias grep='grep --color=auto' +alias rg='rg --smart-case' +alias less='less -R' +alias more='more -R' + +# ============================================================ +# Safety +# ============================================================ +alias please='sudo' + +# ============================================================ +# Editors +# ============================================================ +alias emacs='emacs --no-splash -nw' + +# ============================================================ +# File utilities +# ============================================================ +# Use GNU readlink to determine absolute filepaths +command -v greadlink &>/dev/null && alias realpath='greadlink -f' + +# ============================================================ +# Git shortcuts (supplements .gitconfig aliases) +# ============================================================ +alias g='git' +alias gs='git status -s' +alias gd='git diff' + +# ============================================================ +# Python +# ============================================================ +alias jsontool='python3 -m json.tool' + +# ============================================================ +# Misc +# ============================================================ +# http://xkcd.com/530/ +alias stfu="osascript -e 'set volume output muted true'" +alias pumpitup="osascript -e 'set volume 10'" + +# open all merge conflicts or currently changed files in editor +alias fixchanges="git diff --name-only | uniq | xargs \$EDITOR" diff --git a/shell/dircolors.sh b/shell/dircolors.sh new file mode 100644 index 0000000..8065963 --- /dev/null +++ b/shell/dircolors.sh @@ -0,0 +1,10 @@ +# dircolors setup +# requires GNU `dircolors` + `ls` +# `brew install coreutils` + +# https://github.com/seebi/dircolors-solarized +if command -v gdircolors &>/dev/null; then + eval "$(gdircolors ~/.dircolors)" +elif command -v dircolors &>/dev/null; then + eval "$(dircolors ~/.dircolors)" +fi diff --git a/shell/exports.sh b/shell/exports.sh new file mode 100644 index 0000000..bce499e --- /dev/null +++ b/shell/exports.sh @@ -0,0 +1,61 @@ +# ~/.exports +# Environment variables (zsh-compatible, macOS/Apple Silicon focused) + +# ============================================================ +# History (zsh) +# ============================================================ +export HISTSIZE=100000 +export SAVEHIST=100000 +export HISTFILE=~/.zsh_history + +setopt EXTENDED_HISTORY # Timestamp format :start:elapsed:command +setopt INC_APPEND_HISTORY # Write immediately, not on exit +setopt SHARE_HISTORY # Share between sessions +setopt HIST_EXPIRE_DUPS_FIRST # Expire dupes first +setopt HIST_IGNORE_DUPS # Don't record immediate dupes +setopt HIST_IGNORE_ALL_DUPS # Remove older dupe entries +setopt HIST_FIND_NO_DUPS # Don't show dupes when searching +setopt HIST_IGNORE_SPACE # Don't record entries starting with space +setopt HIST_SAVE_NO_DUPS # Don't write dupes to file +setopt HIST_REDUCE_BLANKS # Remove extra blanks + +# ============================================================ +# Editor +# ============================================================ +export EDITOR="subl -n -w" +export VISUAL="$EDITOR" +export GIT_EDITOR="$EDITOR" + +# ============================================================ +# Pager +# ============================================================ +export MANPAGER="less -X" +export PAGER="less" +export LESS="-R" + +# ============================================================ +# Locale +# ============================================================ +export LANG="en_US.UTF-8" +export LC_ALL="en_US.UTF-8" + +# ============================================================ +# Silence +# ============================================================ +unsetopt BEEP + +# ============================================================ +# macOS / Apple Silicon +# ============================================================ +if [[ "$(uname)" == "Darwin" ]]; then + # Java (use whatever version is installed) + if [[ -x /usr/libexec/java_home ]]; then + JAVA_HOME="$(/usr/libexec/java_home 2>/dev/null)" && export JAVA_HOME + fi + + # Go (modern setup - modules, no GOPATH needed) + export GOBIN="$HOME/go/bin" + + # Homebrew Cask install location + export HOMEBREW_CASK_OPTS="--appdir=/Applications" +fi diff --git a/shell/functions.sh b/shell/functions.sh new file mode 100644 index 0000000..59c6abc --- /dev/null +++ b/shell/functions.sh @@ -0,0 +1,109 @@ +# ~/.functions +# Shell functions + +# ============================================================ +# Directory utilities +# ============================================================ + +# Create directory and cd into it +mkd() { + mkdir -p "$@" && cd "$_" +} + +# cd to Finder's current directory (macOS) +cdf() { + local target + target=$(osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)' 2>/dev/null) + if [[ -n "$target" ]]; then + cd "$target" && pwd + else + echo 'No Finder window found' >&2 + return 1 + fi +} + +# ============================================================ +# HTTP server (Python 3) +# ============================================================ +server() { + local port="${1:-8000}" + echo "Starting server at http://localhost:${port}/" + open "http://localhost:${port}/" + python3 -m http.server "$port" +} + +# ============================================================ +# Man pages in Preview.app (macOS) +# ============================================================ +if [[ -d "/Applications/Preview.app" ]]; then + pman() { + man -t "$@" | open -f -a Preview + } +fi + +# ============================================================ +# Git log with GitHub URLs (iTerm2 clickable) +# ============================================================ +gf() { + local remote user_repo + remote="$(git remote -v | awk '/^origin.*\(push\)$/ {print $2}')" + [[ -z "$remote" ]] && return 1 + user_repo="$(echo "$remote" | perl -pe 's/.*://;s/\.git$//')" + git log "$@" --name-status --color | awk " + /^.*commit [0-9a-f]{40}/ {sha=substr(\$2,1,7)} + /^[MA]\t/ {printf \"%s\thttps://github.com/$user_repo/blob/%s/%s\n\", \$1, sha, \$2; next} + /.*/ {print \$0} + " | less -F +} + +# ============================================================ +# iTerm2 utilities +# ============================================================ +if [[ "$TERM_PROGRAM" == 'iTerm.app' ]]; then + nametab() { + [[ -z "$1" ]] && { echo "Usage: nametab "; return 1; } + echo -ne "\033]0;$*\007" + } +fi + +# ============================================================ +# Fun +# ============================================================ +fortune_cow() { + fortune | cowsay -f tux -W 50 | lolcat -p 2 +} + +# 8-bit music generator (requires sox) +eightbit() { + awk 'function wl() { + rate=64000; + return (rate/160)*(0.87055^(int(rand()*10)))}; + BEGIN { + srand(); wla=wl(); + while(1) { + wlb=wla; wla=wl(); + if (wla==wlb) {wla*=2}; + d=(rand()*10+5)*rate/4; + a=b=0; c=128; ca=40/wla; cb=20/wlb; + de=rate/10; di=0; + for (i=0;iwla) {a=0; ca*=-1}; + if (b>wlb) {b=0; cb*=-1}; + if (di>de) {di=0; ca*=0.9; cb*=0.9}; + printf("%c",c)}; + c=int(c); + while(c!=128) { c<128?c++:c--; printf("%c",c)}}}' | + sox -t raw -r 64k -c 1 -e unsigned -b 8 - -d +} + +# ============================================================ +# Search (ripgrep + fzf) +# ============================================================ +# Interactive ripgrep with fzf preview +rgf() { + rg --color=always --line-number --no-heading "$@" | + fzf --ansi --delimiter : \ + --preview 'bat --color=always --highlight-line {2} {1}' \ + --preview-window '+{2}-5' +} diff --git a/shell/path.sh b/shell/path.sh new file mode 100644 index 0000000..2dbe652 --- /dev/null +++ b/shell/path.sh @@ -0,0 +1,35 @@ +# ~/.path +# PATH configuration (Apple Silicon focused) + +# ============================================================ +# Homebrew (Apple Silicon: /opt/homebrew, Intel: /usr/local) +# ============================================================ +if [[ -d "/opt/homebrew" ]]; then + eval "$(/opt/homebrew/bin/brew shellenv)" +elif [[ -d "/usr/local/Homebrew" ]]; then + eval "$(/usr/local/bin/brew shellenv)" +fi + +# ============================================================ +# User binaries +# ============================================================ +export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/bin:$PATH" + +# ============================================================ +# Language-specific +# ============================================================ +# Go +[[ -d "$HOME/go/bin" ]] && export PATH="$HOME/go/bin:$PATH" + +# Bun +if [[ -d "$HOME/.bun" ]]; then + export BUN_INSTALL="$HOME/.bun" + export PATH="$BUN_INSTALL/bin:$PATH" +fi + +# ============================================================ +# Container tools +# ============================================================ +# Rancher Desktop +[[ -d "$HOME/.rd/bin" ]] && export PATH="$HOME/.rd/bin:$PATH" diff --git a/starship/starship.toml b/starship/starship.toml new file mode 100644 index 0000000..f5e12ea --- /dev/null +++ b/starship/starship.toml @@ -0,0 +1,25 @@ +[directory] +truncation_length = 0 + +[time] +disabled = false +style = "bold green" + +[username] +show_always = true +format = "[$user]($style)@" +style_user = "blue" + + +[hostname] +ssh_only = false +trim_at = "" +style = "blue" + +[character] +success_symbol = "[λ](bold green)" +error_symbol = "[λ](bold red)" +format = """ + +$symbol +""" diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..26d4ce5 --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,43 @@ +# ~/.tmux.conf +# Modern macOS configuration (no reattach-to-user-namespace needed since tmux 2.6+) + +# ============================================================ +# General +# ============================================================ +set -g default-terminal "tmux-256color" +set -ag terminal-overrides ",xterm-256color:RGB" +set -g default-shell /bin/zsh +set -g history-limit 50000 +set -s escape-time 0 +set -g allow-passthrough all + +# Window/pane numbering from 1 +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on + +# ============================================================ +# Mouse & clipboard +# ============================================================ +set -g mouse on +set -g set-clipboard on + +# Vi copy mode with system clipboard +setw -g mode-keys vi +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy" + +# ============================================================ +# Key bindings +# ============================================================ +bind r source-file ~/.tmux.conf \; display "Config reloaded" +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" + +# ============================================================ +# Appearance (Solarized Dark from seebi/tmux-colors-solarized) +# ============================================================ +set -g status-style bg=black,fg=white +set -g window-status-current-style bg=white,fg=black,bold +set -g pane-border-style fg=colour238 +set -g pane-active-border-style fg=colour39 diff --git a/tmux/.tmux.macOS.conf b/tmux/.tmux.macOS.conf deleted file mode 100644 index bbc0b2f..0000000 --- a/tmux/.tmux.macOS.conf +++ /dev/null @@ -1,14 +0,0 @@ -# Partial usage of https://github.com/mathias/dotfiles/blob/master/tmux/.tmux.conf -# tmux.conf -# -# Meant to be used with tmux >= 1.6 - -# Make copy/paste work. -set -g default-command "which reattach-to-user-namespace &> /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" - -# More scrollback: (30k lines is nothing in RAM hah) -set-option -g history-limit 30000 - -# OS X copying -bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" -bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer" diff --git a/todo.cfg b/todo.cfg deleted file mode 100644 index 20c89f9..0000000 --- a/todo.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Your todo.txt directory -export TODO_DIR=$DROPBOX/todo - -export TODOTXT_DEFAULT_ACTION=ls - -# Your todo/done/report.txt locations -export TODO_FILE="$TODO_DIR/todo.txt" -export DONE_FILE="$TODO_DIR/done.txt" -export REPORT_FILE="$TODO_DIR/report.txt" diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..f386549 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,102 @@ +# ~/.zshrc +# Zsh configuration for macOS (Apple Silicon) +# Managed via Fresh from ~/.dotfiles + +# ============================================================ +# Fresh shell manager +# ============================================================ +source ~/.fresh/build/shell.sh + +# ============================================================ +# Cross-shell configs (managed by Fresh) +# ============================================================ +for file in ~/.{exports,path,aliases,functions,extra}; do + [[ -r "$file" ]] && source "$file" +done +unset file + +# ============================================================ +# Completions +# ============================================================ +# Homebrew completions (Apple Silicon path) - must be before compinit +if type brew &>/dev/null; then + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" +fi + +autoload -Uz compinit +# Rebuild completion cache once per day +if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.mh+24) ]]; then + compinit +else + compinit -C +fi + +# ============================================================ +# Prompt: Starship +# ============================================================ +if command -v starship &>/dev/null; then + eval "$(starship init zsh)" +fi + +# ============================================================ +# Modern CLI tools +# ============================================================ +# zoxide - smart directory jumping (replaces fasd/z/autojump) +if command -v zoxide &>/dev/null; then + eval "$(zoxide init zsh)" +fi + +# fzf - fuzzy finder +if command -v fzf &>/dev/null; then + source <(fzf --zsh) +fi + +# zsh-history-substring-search +if [[ -f "$(brew --prefix 2>/dev/null)/share/zsh-history-substring-search/zsh-history-substring-search.zsh" ]]; then + source "$(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh" +fi + +# ============================================================ +# Key bindings +# ============================================================ +# Word navigation (Option + arrow keys in iTerm2) +bindkey "[D" backward-word # opt-left +bindkey "[C" forward-word # opt-right + +# History search with up/down arrows (if substring-search loaded) +if (( $+functions[history-substring-search-up] )); then + bindkey "^[[A" history-substring-search-up + bindkey "^[[B" history-substring-search-down +fi + +# ============================================================ +# Colors +# ============================================================ +[[ -f ~/.dircolors ]] && eval "$(gdircolors ~/.dircolors)" + +# ============================================================ +# Tool integrations +# ============================================================ +# iTerm2 shell integration +[[ -e "${HOME}/.iterm2_shell_integration.zsh" ]] && \ + source "${HOME}/.iterm2_shell_integration.zsh" + +# nvm (Node version manager) +export NVM_DIR="$HOME/.nvm" +[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" +[[ -s "$NVM_DIR/bash_completion" ]] && source "$NVM_DIR/bash_completion" + +# bun +if [[ -d "${HOME}/.bun" ]]; then + export BUN_INSTALL="${HOME}/.bun" + [[ -s "${BUN_INSTALL}/_bun" ]] && source "${BUN_INSTALL}/_bun" + export PATH="${BUN_INSTALL}/bin:${PATH}" +fi + +# thefuck (if installed) +command -v thefuck &>/dev/null && eval "$(thefuck --alias)" + +# ============================================================ +# Local overrides (not in git) +# ============================================================ +[[ -r ~/.zshrc.local ]] && source ~/.zshrc.local