Last active
August 1, 2024 04:31
-
-
Save dezashibi/c9c68d92439377b3fb3ecbbc9a802cfc to your computer and use it in GitHub Desktop.
My Powershell prompt settings, open this by running `notepad.exe $profile` in powershell, add the content, save then enter ". $profile"
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 Get-GitBranch { | |
$branch = & git rev-parse --abbrev-ref HEAD 2>$null | |
if ($LASTEXITCODE -eq 0) { | |
return "($branch)" | |
} | |
return "" | |
} | |
function Prompt { | |
$currentTime = Get-Date -Format "HH:mm:ss" | |
$currentPath = $(Get-Location) | |
$gitBranch = Get-GitBranch | |
$userName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name | |
$ansiReset = "`e[00m" | |
$ansiCyan = "`e[01;36m" | |
$ansiBlue = "`e[01;34m" | |
$ansiGreen = "`e[01;32m" | |
$ansiYellow = "`e[01;33m" | |
$prompt = "$ansiReset┌ $ansiCyan$currentTime $ansiBlue$currentPath$ansiReset`n" | |
$prompt += "└ ${ansiGreen}$userName ${ansiYellow}$gitBranch${ansiGreen}" | |
$prompt += "$ansiReset>" | |
Write-Host $prompt -NoNewline | |
return " " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment