diff --git a/Bootstrap/stow.sh b/Bootstrap/stow.sh index 96b52f3..11725bc 100755 --- a/Bootstrap/stow.sh +++ b/Bootstrap/stow.sh @@ -52,10 +52,16 @@ get_packages() { fi done else + local os + os=$(uname -s) for dir in */; do # Skip non-stow directories [[ "$dir" == "Bootstrap/" ]] && continue [[ "$dir" == "macOS/" ]] && continue # macOS-specific (apps, not symlinks) + if [[ "$os" != "Darwin" ]]; then + [[ "$dir" == "Hammerspoon/" ]] && continue + [[ "$dir" == "TeX/" ]] && continue + fi PACKAGES+=("${dir%/}") done fi diff --git a/Git/.gitconfig-essential b/Git/.gitconfig-essential index c326e03..c2e5b0e 100644 --- a/Git/.gitconfig-essential +++ b/Git/.gitconfig-essential @@ -36,7 +36,7 @@ remotes = remote -v unstage = reset -q HEAD -- - discard = checkout -- + discard = restore -- uncommit = reset --mixed HEAD~ amend = commit --amend --no-edit @@ -50,7 +50,7 @@ wordRegex = . [push] - default = upstream + default = simple followTags = true autoSetupRemote = true diff --git a/README.md b/README.md index 18afc53..f59c798 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Works on both Intel and Apple Silicon Macs. The script is idempotent and can be | `Vim/` | Both | Vim config; Neovim uses Lua with LSP, Treesitter, Telescope | | `Yazi/` | Both | Yazi file manager configuration | | `Zellij/` | Both | Zellij terminal multiplexer configuration | -| `Zsh/` | macOS | Zsh configuration (standalone) | +| `Zsh/` | Both | Zsh configuration (standalone) | ### Shell Configuration @@ -59,7 +59,7 @@ Both Bash and Zsh source `~/.shell_common` for shared settings: - PATH configuration - Editor setup (auto-detects nvim if available) -Platform-specific options are in `.bash_aliases` (Linux) and `.zshrc` (macOS). +Platform-specific options are in `.bash_aliases` (Linux-specific) and `.zshrc` (additional shell-specific configuration). ## Individual Scripts diff --git a/Shell/.shell_common b/Shell/.shell_common index 2a3f787..fec6d2c 100644 --- a/Shell/.shell_common +++ b/Shell/.shell_common @@ -19,13 +19,19 @@ alias la='ls -A' alias l='ls -CF' # Make zip archives easier -alias zipr='f() { zip -r "$1.zip" "$1"; }; f' +zipr() { + if [ -z "$1" ]; then + echo "Usage: zipr " >&2 + return 1 + fi + zip -r "$1.zip" "$1" +} # Quick file search alias ff='find . -name' # Disk usage -alias duh='du -h --max-depth=1 2>/dev/null | sort -h' +alias duh='du -h -d 1 2>/dev/null | sort -h' # ============================================================================= # Safety prompts diff --git a/Zsh/.zprofile b/Zsh/.zprofile index 0baab6b..5bf5aa4 100644 --- a/Zsh/.zprofile +++ b/Zsh/.zprofile @@ -5,9 +5,11 @@ if [[ "$OSTYPE" == darwin* ]]; then export BROWSER='open' fi -# Editors +# Editor export EDITOR='vim' -export VISUAL='vim' +export VISUAL="$EDITOR" + +# Pager export PAGER='less' # Language @@ -38,4 +40,8 @@ fi TMPPREFIX="${TMPDIR%/}/zsh" # Homebrew -eval "$(/opt/homebrew/bin/brew shellenv)" +if [[ -x /opt/homebrew/bin/brew ]]; then + eval "$(/opt/homebrew/bin/brew shellenv)" +elif [[ -x /usr/local/bin/brew ]]; then + eval "$(/usr/local/bin/brew shellenv)" +fi diff --git a/Zsh/.zshrc b/Zsh/.zshrc index 70745da..dbe63a6 100644 --- a/Zsh/.zshrc +++ b/Zsh/.zshrc @@ -11,10 +11,6 @@ fi # ============================================================================= # Environment # ============================================================================= -# Default editor -export EDITOR='nvim' -export VISUAL='nvim' - # Smart URLs (from Prezto environment module) autoload -Uz is-at-least if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then @@ -43,6 +39,11 @@ unsetopt BG_NICE # Don't lower priority of background jobs unsetopt HUP # Don't kill jobs on shell exit unsetopt CHECK_JOBS # Don't report on jobs when shell exits +# ============================================================================= +# Common Shell Configuration +# ============================================================================= +[[ -f "$HOME/.shell_common" ]] && source "$HOME/.shell_common" + # ============================================================================= # History # ============================================================================= @@ -320,11 +321,6 @@ if command -v nnn &>/dev/null; then } fi -# ============================================================================= -# Common Shell Configuration -# ============================================================================= -[[ -f "$HOME/.shell_common" ]] && source "$HOME/.shell_common" - # ============================================================================= # macOS-specific aliases # =============================================================================