Created
April 16, 2018 13:30
-
-
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.
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code lands in the $profile file, which probably needs to be created:
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)