Skip to content

Instantly share code, notes, and snippets.

@orgmir
Created April 16, 2018 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orgmir/d887736e812d39f17c4177aebdd24a9e to your computer and use it in GitHub Desktop.
Save orgmir/d887736e812d39f17c4177aebdd24a9e to your computer and use it in GitHub Desktop.
Prompt for powershell that imitates robbierussel oh-my-zsh theme, including basic git branch support.
function prompt {
$ESC = [char]27
$p = Split-Path -leaf -path (Get-Location)
$branch = $(git symbolic-ref -q HEAD) -replace "refs/heads/"
if ($branch) {
$branch = "$ESC[34mgit:($ESC[0m$ESC[31m$branch$ESC[0m$ESC[34m)$ESC[0m "
}
"$ESC[1m$ESC[32m$([char]0x279C)$ESC[0m $ESC[36m$p$ESC[0m $branch$ESC[0m"
}
Set-Alias st subl.exe
@orgmir
Copy link
Author

orgmir commented Apr 16, 2018

This code lands in the $profile file, which probably needs to be created:

new-item -itemtype file -path $profile -force
notepad $PROFILE

Notepad should open up and you can copy+paste the snipped there!

This file is also where you can add alias, so I've added one for sublime text (which is already in my path)

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