feat(bash): split monolithic .bashrc into focused ~/.config/bash modules#151
Merged
Conversation
Split the monolithic .bashrc into six focused modules under ~/.config/bash/ that are sourced in a defined, documented order: options.bash — shopt flags and set -o vi prompt.bash — Ghostty integration + starship (sets PROMPT_COMMAND) tools.bash — brew, chruby, zoxide, direnv, fzf, gcloud, nomad history.bash — prepends 'history -a' to PROMPT_COMMAND last completions.bash — system-wide and Homebrew tab completions ssh_agent.bash — auto-start / attach SSH agent .bashrc is now a thin loader (~40 lines) with inline comments explaining the load order and why it matters (PROMPT_COMMAND ordering). Also clean up .aliases: - remove duplicate aliases (gd, c, q) - fix tree guard (was always true due to &>/dev/null in subshell) - modernise pserve from python 2 SimpleHTTPServer to python3 http.server Update README.md with a Bash modules table, required/optional tools, and a note on the load-order contract.
Copilot
AI
changed the title
feat(bash): modernise shell config with modular ~/.config/bash layout
feat(bash): split monolithic .bashrc into focused ~/.config/bash modules
Jul 8, 2026
Copilot created this pull request from a session on behalf of
bdossantos
July 8, 2026 11:28
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the Bash configuration in this dotfiles repo by splitting the previous monolithic ~/.bashrc into a thin loader plus focused modules under ~/.config/bash/, and updates documentation/aliases to match.
Changes:
- Introduces
~/.config/bash/*.bashmodules (options, prompt, tools, history, completions, ssh-agent) and updates.bashrcto source them in an explicit order. - Cleans up
.aliases(dedupes aliases, fixestreefallback guard, updatespserveto Python 3). - Updates ignore rules and README documentation for the new Bash module structure.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new Bash module layout and load order. |
| .gitignore | Adjusts tracked ~/.config subtrees to include the new bash modules directory. |
| .config/bash/options.bash | Extracts shell options (shopt, set -o vi) into a dedicated module. |
| .config/bash/prompt.bash | Extracts Ghostty + starship prompt initialization into a dedicated module. |
| .config/bash/tools.bash | Extracts third-party tool hooks (brew/direnv/zoxide/fzf/etc.) into a dedicated module. |
| .config/bash/history.bash | Ensures history -a is prepended to PROMPT_COMMAND after other setters. |
| .config/bash/completions.bash | Extracts system + Homebrew completion initialization into a dedicated module. |
| .config/bash/ssh_agent.bash | Extracts ssh-agent auto-start/attach and key loading into a dedicated module. |
| .bashrc | Becomes a thin loader that sources modules in a documented order and then loads aliases/extra/zellij. |
| .aliases | Removes duplicates and fixes/modernizes a few aliases and guards. |
Comment on lines
+3
to
6
| # ~/.bashrc — thin loader; all logic lives in ~/.config/bash/*.bash | ||
|
|
||
| # vi mode | ||
| set -o vi | ||
| _bash_config="${HOME}/.config/bash" | ||
|
|
Comment on lines
+7
to
+10
| if [[ -n "${GHOSTTY_RESOURCES_DIR}" ]]; then | ||
| # shellcheck source=/dev/null | ||
| builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.bashrchad grown to ~150 lines mixing options, completions, tool hooks, history, and SSH agent logic — hard to navigate and reason about load order.Changes
New:
~/.config/bash/modulesoptions.bashshoptflags +set -o viprompt.bashPROMPT_COMMANDsetter)tools.bashhistory.bashhistory -atoPROMPT_COMMAND— intentionally lastcompletions.bashssh_agent.bashLoad order in
.bashrcis explicit and annotated —history.bashmust run afterprompt.bashandtools.bashbecause both starship and direnv append toPROMPT_COMMANDbeforehistory -ais prepended..bashrcThin loader, ~40 lines, with guarded
sourcecalls and comments on ordering constraints..aliasesfixesgd,c,qaliasestreefallback guard —[ ! -x "$(command -v tree &>/dev/null)" ]was alwaystrue(subshell output suppressed); replaced with! command -v tree &>/dev/nullpserve:python -m SimpleHTTPServer(Python 2) →python3 -m http.serverREADME.mdAdded Bash modules section with load-order table and required/optional tool inventory.