How I use a single .zshrc file on macOS and Windows (WSL2)
1 points by Dew
1 points by Dew
Author here. I work across a MacBook and two Windows PCs running WSL2. Most of my shell configuration is identical, but specifically ssh kept getting in the way because I use 1Password to keep my ssh keys, and on Windows it requires a bit of an orchestration to get it work properly in the terminal. Also, mac has the open command which I use sparingly, and I wanted something similar on Windows.
I ended up syncing a single .zshrc with chezmoi and keeping the WSL-specific behavior inside one small conditional. I prefer that to maintaining separate files that will probably drift apart eventually.
I'm curious how others handle cross-OS or cross-machine config. Do you use conditionals, source machine-specific files, generate configs from templates, or take a different approach? My setup works well for me, but I'd love to get some inspiration.
Personally I use a common .zshrc, and separate .zshrc.work .zshrc.home, so that I only need to check a flag then source it. That cognitive load will be less. And also I recommend to checkout gnu stow.