Paste the following into ~/.zshrc:
# Source every shell file in .dotfiles
for file in "$HOME/.dotfiles"/*.sh; do
[[ -e "$file" ]] || continue # Skip if no .sh files are found
[[ -r "$file" ]] && source "$file"
done
And the place organized dot files into $HOME/.dotfiles, following the naming scheme section below.
e.g.
➜ .dotfiles > tree
.
├── 1-local-bin.sh
├── 1-ssh-agent.sh
├── 1-zsh-init.sh
├── 3-android.sh
├── 3-google-cloud-sdk.sh
├── 3-gradle-helpers.sh
├── 3-nvm.sh
├── 3-openai.sh
├── 3-sublime-text.sh
├── 4-atuin.sh
├── 5-sdkman-init.sh
├── 6-pyenv.sh
├── 7-python-uv.sh
└── README.md
➜ .dotfiles > cat 3-gradle-helpers.sh
alias gw='./gradlew'
alias gwp='./gradlew -p'
The shell scripts in this directory will be processed in lexigraphic order. In order to have some control over the order the files will be prefixed.
By default prefix a shell file with 3, e.g. 3-android.sh.
If some new file needs to run earlier, then prefix it with 1-[name].sh or 2-[name].sh.
This should be sufficient for now.