Skip to content

Instantly share code, notes, and snippets.

@Konyuka
Last active January 22, 2026 11:40
Show Gist options
  • Select an option

  • Save Konyuka/4ba65411d1482f9d7520b3cc5af5d00a to your computer and use it in GitHub Desktop.

Select an option

Save Konyuka/4ba65411d1482f9d7520b3cc5af5d00a to your computer and use it in GitHub Desktop.
πŸš€ PowerShell Developer Setup Guide

πŸš€ Ultimate PowerShell Developer Profile Guide

A complete, copy-pasteable solution for your PowerShell Developer Profile.
Integrates Oh My Posh, PSReadLine, and custom aliases for Laravel (Artisan) and Git.


πŸ“‹ Table of Contents

  1. Prerequisites
  2. Step 1: Install Required Tools
  3. Step 2: Configure Terminal Font
  4. Step 3: Create Your Profile
  5. Step 4: The Profile Script
  6. Step 5: Apply and Enable
  7. Alias Quick Reference
  8. Pro Tips
  9. Troubleshooting

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

Requirement Description Check Command
Windows 10/11 Windows Terminal recommended -
PowerShell 7+ Modern PowerShell (not Windows PowerShell 5.1) $PSVersionTable.PSVersion
Winget Windows Package Manager winget --version
Git For Git aliases to work git --version
PHP (optional) For Laravel/Artisan aliases php --version

πŸ’‘ Tip: Install PowerShell 7+ via: winget install Microsoft.PowerShell


πŸ”§ Step 1: Install Required Tools

Open PowerShell as Administrator and run these commands:

Install Oh My Posh

# Install Oh My Posh - the prompt theme engine
winget install JanDeDobbeleer.OhMyPosh -s winget

Install Nerd Font

# Install the MesloLGM NF Nerd Font (Required for icons to display correctly)
oh-my-posh font install meslo

⚠️ Important: Without a Nerd Font, icons will appear as broken boxes β–‘β–‘β–‘


πŸ”€ Step 2: Configure Terminal Font

You must change your terminal font to MesloLGM NF for icons to render properly.

Windows Terminal

  1. Open Settings (Ctrl + ,)
  2. Navigate to Profiles β†’ Defaults β†’ Appearance
  3. Set Font face to MesloLGM NF
  4. (Optional) Set font size to 12 for best readability

VS Code Integrated Terminal

  1. Open Settings (Ctrl + ,)
  2. Search for terminal.integrated.fontFamily
  3. Set value to MesloLGM NF
// settings.json
{
  "terminal.integrated.fontFamily": "MesloLGM NF",
  "terminal.integrated.fontSize": 14
}

πŸ’‘ Tip: Restart your terminal after changing fonts for changes to take effect.


πŸ“ Step 3: Create Your Profile

The PowerShell Profile is a script that runs every time you open a new terminal window.

Check if profile exists

# Check your profile path
echo $PROFILE

Create the profile file (if it doesn't exist)

if (!(Test-Path -Path $PROFILE)) { 
    New-Item -ItemType File -Path $PROFILE -Force 
}

Open profile for editing

notepad $PROFILE

πŸ’‘ Tip: You can also use VS Code: code $PROFILE


⚑ Step 4: The Profile Script

Copy and paste the entire block below into your profile file.

# ╔══════════════════════════════════════════════════════════════════╗
# β•‘                  πŸš€ Developer PowerShell Profile                  β•‘
# β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

# ──────────────────────────────────────────────────────────────────────
# 1. PSReadLine Configuration (Command Intelligence)
# ──────────────────────────────────────────────────────────────────────

# Import PSReadLine module for enhanced command-line editing
Import-Module PSReadLine -ErrorAction SilentlyContinue

# Enable predictive IntelliSense based on command history
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -HistorySaveStyle SaveIncrementally
Set-PSReadLineOption -MaximumHistoryCount 50000

# Arrow keys search through history for matching commands
Set-PSReadLineKeyHandler -Key UpArrow   -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

# Ctrl+R for reverse search (like bash)
Set-PSReadLineKeyHandler -Chord Ctrl+r -Function ReverseSearchHistory

# Tab completion with visual menu
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete


# ──────────────────────────────────────────────────────────────────────
# 2. Oh My Posh Theme (Terminal UI)
# ──────────────────────────────────────────────────────────────────────

# Initialize Oh My Posh with the 'illusi0n' theme
# Browse themes: https://ohmyposh.dev/docs/themes
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\illusi0n.omp.json" | Invoke-Expression


# ──────────────────────────────────────────────────────────────────────
# 3. Git Aliases & Functions
# ──────────────────────────────────────────────────────────────────────

function g-status { git status }
Set-Alias -Name gs -Value g-status -Description "Git status"

function g-add { git add $args }
Set-Alias -Name ga -Value g-add -Description "Git add"

function g-add-all { git add . }
Set-Alias -Name gaa -Value g-add-all -Description "Git add all"

function g-commit { 
    param([string]$Message)
    git commit -m $Message 
}
Set-Alias -Name gc -Value g-commit -Description "Git commit"

function g-commit-amend { git commit --amend }
Set-Alias -Name gca -Value g-commit-amend -Description "Git commit amend"

function g-pull { git pull }
Set-Alias -Name gl -Value g-pull -Description "Git pull"

function g-push { git push }
Set-Alias -Name gp -Value g-push -Description "Git push"

function g-push-force { git push --force-with-lease }
Set-Alias -Name gpf -Value g-push-force -Description "Git push force (safe)"

function g-branch { git branch $args }
Set-Alias -Name gb -Value g-branch -Description "Git branch"

function g-checkout { git checkout $args }
Set-Alias -Name gco -Value g-checkout -Description "Git checkout"

function g-log { git log --oneline --graph --decorate -20 }
Set-Alias -Name glog -Value g-log -Description "Git log (pretty)"

function g-diff { git diff $args }
Set-Alias -Name gd -Value g-diff -Description "Git diff"


# ──────────────────────────────────────────────────────────────────────
# 4. Laravel / Artisan Aliases
# ──────────────────────────────────────────────────────────────────────

function pa { php artisan $args }
Set-Alias -Name art -Value pa -Description "PHP Artisan"

function pa-migrate { php artisan migrate }
Set-Alias -Name pam -Value pa-migrate -Description "Artisan migrate"

function pa-migrate-fresh { php artisan migrate:fresh --seed }
Set-Alias -Name pamf -Value pa-migrate-fresh -Description "Artisan fresh migrate with seed"

function pa-tinker { php artisan tinker }
Set-Alias -Name pat -Value pa-tinker -Description "Artisan tinker"

function pa-serve { php artisan serve }
Set-Alias -Name pas -Value pa-serve -Description "Artisan serve"

function pa-cache-clear { 
    php artisan cache:clear
    php artisan config:clear
    php artisan route:clear
    php artisan view:clear
    Write-Host "βœ… All caches cleared!" -ForegroundColor Green
}
Set-Alias -Name pacc -Value pa-cache-clear -Description "Clear all Laravel caches"


# ──────────────────────────────────────────────────────────────────────
# 5. Node.js / NPM Aliases
# ──────────────────────────────────────────────────────────────────────

function npm-dev { npm run dev }
Set-Alias -Name nd -Value npm-dev -Description "NPM run dev"

function npm-build { npm run build }
Set-Alias -Name nb -Value npm-build -Description "NPM run build"

function npm-install { npm install }
Set-Alias -Name ni -Value npm-install -Description "NPM install"


# ──────────────────────────────────────────────────────────────────────
# 6. Utility Functions
# ──────────────────────────────────────────────────────────────────────

# Profile Management
function Edit-Profile { code $PROFILE }
Set-Alias -Name ep -Value Edit-Profile -Description "Edit profile in VS Code"

function Reload-Profile { 
    . $PROFILE 
    Write-Host "βœ… Profile reloaded!" -ForegroundColor Green
}
Set-Alias -Name rp -Value Reload-Profile -Description "Reload profile"

# Quick Navigation
function Go-Projects { Set-Location "C:\Projects" }
Set-Alias -Name cdp -Value Go-Projects -Description "Go to Projects folder"

function Go-Desktop { Set-Location "$env:USERPROFILE\Desktop" }
Set-Alias -Name cdd -Value Go-Desktop -Description "Go to Desktop"

# System Utilities
function Get-PublicIP { (Invoke-WebRequest -Uri "https://api.ipify.org").Content }
Set-Alias -Name myip -Value Get-PublicIP -Description "Get public IP"

function Clear-RecycleBin { Clear-RecycleBin -Force -ErrorAction SilentlyContinue }
Set-Alias -Name emptytrash -Value Clear-RecycleBin -Description "Empty recycle bin"

# File Operations
function touch { 
    param([string]$Path)
    if (Test-Path $Path) {
        (Get-Item $Path).LastWriteTime = Get-Date
    } else {
        New-Item -ItemType File -Path $Path -Force | Out-Null
    }
}

function mkcd {
    param([string]$Path)
    New-Item -ItemType Directory -Path $Path -Force | Out-Null
    Set-Location $Path
}


# ──────────────────────────────────────────────────────────────────────
# 7. Welcome Message
# ──────────────────────────────────────────────────────────────────────

Write-Host ""
Write-Host "  πŸš€ Developer PowerShell Profile Loaded" -ForegroundColor Cyan
Write-Host "  πŸ“ Type 'ep' to edit profile | 'rp' to reload" -ForegroundColor DarkGray
Write-Host ""

βœ… Step 5: Apply and Enable

1. Save the profile

Press Ctrl + S to save the file, then close Notepad.

2. Enable script execution (Run as Administrator)

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

πŸ”’ Security Note: RemoteSigned only allows local scripts to run. Downloaded scripts must be signed.

3. Reload your profile

. $PROFILE

Or simply close and reopen your terminal.


πŸ“š Alias Quick Reference

Git Commands

Alias Command Description
gs git status Check repository status
ga git add <files> Stage files
gaa git add . Stage all changes
gc "msg" git commit -m "msg" Commit with message
gca git commit --amend Amend last commit
gl git pull Pull from remote
gp git push Push to remote
gpf git push --force-with-lease Safe force push
gb git branch List/create branches
gco git checkout <branch> Switch branches
glog git log --oneline Pretty log view
gd git diff Show differences

Laravel / Artisan Commands

Alias Command Description
art / pa php artisan Run any artisan command
pam php artisan migrate Run migrations
pamf php artisan migrate:fresh --seed Fresh DB with seeds
pat php artisan tinker Open Tinker REPL
pas php artisan serve Start dev server
pacc - Clear all caches

Node.js / NPM Commands

Alias Command Description
nd npm run dev Start dev server
nb npm run build Build for production
ni npm install Install dependencies

Utility Commands

Alias Command Description
ep Opens $PROFILE in VS Code Edit your profile
rp Reloads profile Apply changes
cdp cd C:\Projects Go to projects
cdd cd ~/Desktop Go to desktop
myip - Show public IP address
touch <file> - Create file (like Linux)
mkcd <dir> - Create and enter directory

πŸ’‘ Pro Tips

1. Browse Oh My Posh Themes

# List all available themes
Get-ChildItem $env:POSH_THEMES_PATH

# Preview a theme
oh-my-posh print primary --config "$env:POSH_THEMES_PATH\{theme-name}.omp.json"

Popular themes: agnoster, paradox, powerlevel10k_rainbow, atomic, night-owl

2. Useful PSReadLine Shortcuts

Shortcut Action
↑ / ↓ Search history for current input
Ctrl + R Reverse search history
Ctrl + A Select all
Ctrl + C Cancel current command
Tab Cycle through completions
Ctrl + Space Show all completions
Ctrl + L Clear screen

3. Speed Up Terminal Startup

Add this to the top of your profile to measure load time:

$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
# ... rest of profile ...
$stopwatch.Stop()
Write-Host "Profile loaded in $($stopwatch.ElapsedMilliseconds)ms" -ForegroundColor DarkGray

4. Add Conditional Modules

Only load modules when needed:

# Load Azure module only when needed
function Load-Azure { Import-Module Az -ErrorAction SilentlyContinue }

# Load Posh-Git for enhanced Git integration
if (Get-Command git -ErrorAction SilentlyContinue) {
    Import-Module posh-git -ErrorAction SilentlyContinue
}

5. Create Project-Specific Profiles

Create a .psprofile file in project roots:

# Add to your main profile
if (Test-Path ".\.psprofile") { . ".\.psprofile" }

6. Backup Your Profile

# Create a backup
Copy-Item $PROFILE "$PROFILE.backup.$(Get-Date -Format 'yyyyMMdd')"

7. Install Additional Modules

# Terminal-Icons - Adds file icons to directory listings
Install-Module -Name Terminal-Icons -Repository PSGallery -Force
Import-Module Terminal-Icons

# Posh-Git - Enhanced Git integration with status in prompt
Install-Module -Name posh-git -Repository PSGallery -Force
Import-Module posh-git

# Z - Quick directory jumping (like autojump)
Install-Module -Name z -Repository PSGallery -Force

8. Create a Git Commit Helper

function gac {
    param([string]$Message)
    git add .
    git commit -m $Message
    Write-Host "βœ… Committed: $Message" -ForegroundColor Green
}

Usage: gac "feat: add new feature"


πŸ”§ Troubleshooting

Icons showing as boxes β–‘β–‘β–‘

Solution: Install a Nerd Font and configure your terminal to use it.

oh-my-posh font install meslo

"Running scripts is disabled" error

Solution: Enable script execution:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Oh My Posh not found

Solution: Restart your terminal after installation, or add to PATH manually:

$env:Path += ";$env:LOCALAPPDATA\Programs\oh-my-posh\bin"

Profile not loading

Solution: Check if profile exists and path is correct:

Test-Path $PROFILE          # Should return True
Get-Content $PROFILE        # View profile contents

Slow terminal startup

Solutions:

  1. Remove unused modules
  2. Use lazy loading for heavy modules
  3. Measure with: Measure-Command { . $PROFILE }

Theme not found error

Solution: Check available themes and use correct path:

# List available themes
Get-ChildItem $env:POSH_THEMES_PATH | Select-Object Name

# Use default theme if yours is missing
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json" | Invoke-Expression

πŸ“– Additional Resources

Resource Link
Oh My Posh Documentation ohmyposh.dev/docs
Oh My Posh Themes Gallery ohmyposh.dev/docs/themes
PSReadLine Documentation Microsoft Docs
PowerShell 7 Documentation Microsoft Docs
Nerd Fonts nerdfonts.com
Terminal-Icons Module GitHub

Made with πŸ’™ for developers who love a beautiful terminal

Last updated: January 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment