ENV Switcher Pro — One Click .env Switching
Switch between .env files in one click. Terminals auto-restart.
Zero config. Just install — it auto-detects your .env files.
Features
- Auto-detection — finds all
.env* files in your workspace
- One-click switch — status bar shows active env, click to change
- Diff preview — see what changes before switching (+3, -1, ~2)
- Terminal auto-restart — terminals restart to pick up new env vars
- Missing var warnings — compares
.env vs .env.example
- Color-coded status bar — green = local/dev, yellow = staging, red = production
- Backup on switch — saves
.env.bak before overwriting
- Inline annotation — shows "sourced from .env.staging" when viewing .env
Getting Started
- Install from VS Code Marketplace
- Create your env variants (e.g.
.env.local, .env.staging, .env.production)
- Click the status bar item to switch
Settings
| Setting |
Default |
Description |
envSwitcherPro.enable |
true |
Master on/off |
envSwitcherPro.autoRestartTerminals |
true |
Restart terminals on switch |
envSwitcherPro.validateAgainstExample |
true |
Warn about missing vars vs .env.example |
envSwitcherPro.showInlineDecorations |
true |
Show source annotation in .env |
envSwitcherPro.backupOnSwitch |
true |
Backup .env before overwriting |
envSwitcherPro.excludePatterns |
[".env.vault", ".env*.bak"] |
Files to exclude |
envSwitcherPro.statusBarColors |
{} |
Custom color mapping per env name |
Commands
| Command |
Description |
| ENV Switcher: Switch Environment |
Open env picker |
| ENV Switcher: Validate Missing Variables |
Check .env vs .env.example |
How It Works
- On activation, scans workspace for
.env* files
- Hashes
.env content and compares against variants to detect which is active
- On switch: copies selected file to
.env, restarts terminals, updates status bar
- File watcher re-scans on any
.env* file create/delete/change
License
MIT
| |