Cross-platform reliability fixes for shell configs and git aliases#2
Conversation
- Guard Homebrew eval in .zprofile for both /opt/homebrew and /usr/local - Remove duplicate EDITOR/VISUAL exports (handled by .shell_common) - Move .shell_common sourcing early in .zshrc (before Modern CLI Replacements) - Fix duh alias to use BSD-compatible -d flag instead of --max-depth - Convert zipr alias to function for better functionality - Change git push default to simple for better behavior - Update git discard alias to use modern restore command - Add OS-aware skipping in stow.sh for macOS-only directories - Update README to mark Zsh as cross-platform (Both) Co-authored-by: dbmrq <15813674+dbmrq@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Improves dotfiles portability across macOS (Apple Silicon + Intel) and BSD-like environments by removing hard-coded paths/flags and adjusting shell/git defaults to avoid breakage and alias shadowing.
Changes:
- Make Homebrew initialization in
Zsh/.zprofileresilient to both/opt/homebrewand/usr/local. - Reorder Zsh startup so shared shell config is sourced earlier, and centralize editor detection in
.shell_common. - Modernize a few shared aliases/config defaults (BSD-compatible
duh,ziprfunction, Git push/discard aliases) and avoid stow package errors on non-Darwin.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
Zsh/.zshrc |
Removes duplicate editor exports and sources ~/.shell_common earlier to establish baseline aliases/env before “modern CLI” overrides. |
Zsh/.zprofile |
Removes editor exports and guards brew shellenv for both Apple Silicon and Intel Homebrew locations. |
Shell/.shell_common |
Switches zipr to a function and updates duh to use BSD-compatible du -d. |
Git/.gitconfig-essential |
Updates push default to simple and changes discard alias to use git restore. |
Bootstrap/stow.sh |
Skips Hammerspoon/ and TeX/ when not on Darwin to prevent stow failures. |
README.md |
Marks Zsh/ as supported on both platforms in the structure table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [[ "$(uname -s)" != "Darwin" ]]; then | ||
| [[ "$dir" == "Hammerspoon/" ]] && continue | ||
| [[ "$dir" == "TeX/" ]] && continue | ||
| fi |
There was a problem hiding this comment.
uname -s is executed once per directory iteration. Since the OS value is constant for the script run, compute it once (e.g., local os=$(uname -s)) before the loop (or before the if) and reuse it to reduce repeated subprocess calls and simplify the condition.
| | `Yazi/` | Both | Yazi file manager configuration | | ||
| | `Zellij/` | Both | Zellij terminal multiplexer configuration | | ||
| | `Zsh/` | macOS | Zsh configuration (standalone) | | ||
| | `Zsh/` | Both | Zsh configuration (standalone) | |
There was a problem hiding this comment.
The table now marks Zsh/ as "Both", but later this section still says "Platform-specific options are in .bash_aliases (Linux) and .zshrc (macOS)." That sentence looks outdated given .zshrc contains Linux paths/logic as well; consider updating it for consistency.
| export VISUAL='vim' | ||
| # Pager | ||
| export PAGER='less' | ||
|
|
There was a problem hiding this comment.
EDITOR/VISUAL are no longer set in .zprofile, so they won't be defined for login shells that don't read .zshrc (e.g., non-interactive login shells). If you still want these variables available in that scenario, consider sourcing ~/.shell_common from .zprofile (or keeping minimal EDITOR/VISUAL exports here).
| # Editor | |
| export EDITOR='vim' | |
| export VISUAL="$EDITOR" |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: dbmrq <15813674+dbmrq@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: dbmrq <15813674+dbmrq@users.noreply.github.com>
Dotfiles had hard-coded paths and GNU-specific flags that broke on Intel Macs and BSD systems. Fixed shell sourcing order to prevent modern CLI tools from being shadowed by base aliases.
Shell environment
Zsh/.zprofile: Guard Homebrew eval for both Apple Silicon and Intel paths:
Zsh/.zprofile, Zsh/.zshrc: Remove duplicate
EDITOR/VISUALexports..shell_commonalready handles nvim detection correctly.Zsh/.zshrc: Move
.shell_commonsourcing to line 45 (before Modern CLI Replacements). Base aliases must be set before eza/bat/fzf override them.Cross-platform compatibility
Shell/.shell_common:
duhalias: Change--max-depth=1→-d 1(BSD du compatibility)zipr: Convert from alias to function:zipr() { zip -r "$1.zip" "$1"; }Git modernization
Git/.gitconfig-essential:
upstream→simplecheckout --→restore --Bootstrap
Bootstrap/stow.sh: Skip
Hammerspoon/andTeX/on non-Darwin systems to prevent stow errors.README.md: Mark
Zsh/as "Both" platforms.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.