Created
February 8, 2019 00:55
-
-
Save emmet-m/c75210f4d83337e312c63e8a235974da to your computer and use it in GitHub Desktop.
My current 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
#PsGet. May require manually installing each of these... | |
Import-Module PsGet | |
Import-Module PowerLS | |
Import-Module FindString | |
#Unix like ls: | |
Remove-Item alias:ls | |
Set-Alias -Name ls -Value PowerLS -Option AllScope | |
Set-Alias -Name lls -Value PowerLS -Option AllScope | |
Set-Alias -Name grep -Value FindString -Option AllScope | |
# Turn off that silly beep | |
Set-PSReadlineOption -BellStyle None | |
# Change prompt | |
function prompt | |
{ | |
Write-Host ("(") -nonewline -foregroundcolor Cyan | |
Write-Host ($(Get-Branch)) -nonewline -ForegroundColor DarkYellow | |
Write-Host (")") -nonewline -foregroundcolor Cyan | |
Write-Host ("[") -nonewline -foregroundcolor Cyan | |
Write-Host ($(Get-Location)) -nonewline -foregroundcolor Yellow | |
Write-Host ("]") -nonewline -foregroundcolor Cyan | |
Write-Host ("`r`n|") -nonewline -foregroundcolor Yellow | |
Write-Host ("λ") -nonewline -foregroundcolor DarkRed | |
Write-Host ("> ") -nonewline -foregroundcolor Yellow | |
return " " | |
} | |
# Aliases | |
$PSRC = "~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" | |
function vscode($File) { | |
code -a $File | |
} | |
Set-Alias -Name vim -Value vscode # I'm too used to using vim for everything... | |
# Returns the current git branch, or nothing if not inside a git repo | |
function Get-Branch() { | |
return $(git rev-parse --abbrev-ref HEAD) | |
} | |
#Shows all the files that have changed since the start of the current branch | |
function Show-Changed-Files() { | |
$Branch = Get-Branch | |
git diff --name-only $Branch $(git merge-base $Branch master) | |
} | |
# Unix which replacement | |
Set-Alias which Get-Command | |
# Shortcut for windows diff | |
function Show-Difference($File1, $File2) { | |
Compare-Object (Get-Content $File1) (Get-Content $File2) | |
} | |
Remove-Item -Force alias:diff | |
Set-Alias -Name diff -Value Show-Difference |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment