Created
October 21, 2018 22:42
-
-
Save t-makaro/3a222a95d61938f75684b87a2f4e24b6 to your computer and use it in GitHub Desktop.
My powershell 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
# ************************************************************************* | |
# Script Name: profile.ps1 | |
# Version: 1.2 | |
# Author: Tyler Makaro | |
# Date: August 28, 2018 | |
# | |
# Description: Custom profile for windows powershell. | |
# ************************************************************************* | |
# Create a custom prompt | |
function prompt { | |
$origLastExitCode = $LASTEXITCODE | |
Write-Host 'PS ' -ForegroundColor Darkcyan -nonewline | |
Write-VcsStatus | |
$maxPathLength = 80 | |
$curPath = $ExecutionContext.SessionState.Path.CurrentLocation.Path | |
if ($curPath.Length -gt $maxPathLength) { | |
$curPath = '...' + $curPath.SubString($curPath.Length - $maxPathLength + 3) | |
} | |
Write-Host $curPath -ForegroundColor White | |
$LASTEXITCODE = $origLastExitCode | |
"$('>' * ($nestedPromptLevel + 1)) " | |
} | |
function which($name) { | |
Get-Command $name | Select-Object -ExpandProperty Source | |
} | |
# Stop saving command history | |
Set-PSReadlineOption -HistorySaveStyle SaveNothing | |
# Enable git support | |
Import-Module posh-git | |
$global:GitPromptSettings.BeforeText = '[' | |
$global:GitPromptSettings.AfterText = '] ' | |
# Color highlighting | |
Import-Module Get-ChildItemColor | |
Set-Alias dir Get-ChildItemColor -option AllScope -Force | |
Set-Alias ls Get-ChildItemColorFormatWide -option AllScope -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment