Created
October 23, 2019 18:54
-
-
Save satrapu/6f8ada70e1be9ab06514d6d8efebe0bb to your computer and use it in GitHub Desktop.
Prompt customizations for the PowerShell console running inside Windows Terminal
This file contains hidden or 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
# Prompt based on https://hodgkins.io/ultimate-powershell-prompt-and-git-setup | |
# Edit this file via running the following PS command: if (!(Test-Path -Path $PROFILE)){ New-Item -Path $PROFILE -ItemType File } ; ise $PROFILE | |
function prompt { | |
$realLASTEXITCODE = $LASTEXITCODE | |
Write-Host | |
Write-Host "$ENV:USERNAME@" -NoNewline -ForegroundColor DarkYellow | |
Write-Host "$ENV:COMPUTERNAME" -NoNewline -ForegroundColor Magenta | |
if ($s -ne $null) { | |
# color for PSSessions | |
Write-Host " (`$s: " -NoNewline -ForegroundColor DarkGray | |
Write-Host "$($s.Name)" -NoNewline -ForegroundColor Yellow | |
Write-Host ") " -NoNewline -ForegroundColor DarkGray | |
} | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
Write-Host $($(Get-Location) -replace ($env:USERPROFILE).Replace('\','\\'), "~") -NoNewline -ForegroundColor Blue | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
Write-Host (Get-Date -Format "ddd dd-MMM-yy HH:mm K") -NoNewline -ForegroundColor DarkMagenta | |
Write-Host " : " -NoNewline -ForegroundColor DarkGray | |
$global:LASTEXITCODE = $realLASTEXITCODE | |
Write-VcsStatus | |
Write-Host "" | |
return "> " | |
} | |
# Before setting the aliases below, install Get-ChildItemColor module, | |
# as documented here: https://github.com/joonro/Get-ChildItemColor#install-from-powershellgallery | |
Set-Alias ls Get-ChildItemColor -option AllScope -Force | |
Set-Alias dir Get-ChildItemColor -option AllScope -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment