Overview
The PowerShell configuration uses a modular, directory-based structure inspired by Unix systems. Instead of one monolithic profile file, configuration is split into numbered modules that load in a specific order.Entry Point
The main profile file (Microsoft.PowerShell_profile.ps1) is intentionally lean:
Microsoft.PowerShell_profile.ps1
- Keeps the main profile simple and maintainable
- Makes it easy to add/remove features
- Allows for clear organization by category
- Enables predictable load order through numbering
Configuration Directory Structure
Load Order
Files inconf.d/ are loaded in alphanumeric order using numbered prefixes:
Numbered Prefix Convention
The two-digit prefix determines load order:| Prefix | Purpose | Examples |
|---|---|---|
00-XX | Core initialization | PSReadLine, encoding, error display |
10-XX | Environment setup | $env:EDITOR, $env:PATH |
20-XX | Aliases and shortcuts | Git, tool aliases |
30-XX | External tool integration | bat, eza, zoxide, fzf |
40-XX | Completions | docker, scoop, npm |
50-XX | Functions | Custom function loader |
60-XX | Prompt customization | Oh My Posh |
99-XX | Local overrides | Machine-specific config |
Adding New Modules
To add a new configuration module:- Create a new
.ps1file inconf.d/ - Choose an appropriate numeric prefix based on dependencies
- The file will automatically load on next shell start
Example: Adding a 25-docker.ps1 module
Local Overrides
The99-local.ps1 file is gitignored and intended for machine-specific customization:
~/.config/powershell/conf.d/99-local.ps1
Benefits of This Structure
Modular
Each module has a single responsibility and can be enabled/disabled independently
Predictable
Numbered prefixes ensure consistent load order across machines
Maintainable
Easy to add, remove, or modify specific features without touching other modules
Portable
The entire
~/.config/powershell directory can be versioned and syncedSee Also
- Aliases - Git, tool, and command shortcuts
- Functions - Custom function loading system
- Custom Functions - Individual function documentation
