Last active
September 18, 2018 05:31
-
-
Save skoshy/9546400ebf0dc5b74a9296dc21ea6a67 to your computer and use it in GitHub Desktop.
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
# Makes Powershell tab completion work like Bash | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
# Imports posh-git | |
Import-Module posh-git | |
$GitPromptSettings.DefaultPromptPrefix.Text = '$(Get-Date -f "MM-dd HH:mm:ss") ' | |
$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = 0x3891b7 | |
$GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = $true | |
$GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n' | |
# customize the prompt | |
function prompt { | |
# reset the colors after each time | |
[Console]::ResetColor() | |
& $GitPromptScriptBlock | |
} | |
# Adds "touch" functionality - from https://superuser.com/a/571154 | |
Function New-File | |
{ | |
$file = $args[0] | |
if($file -eq $null) { | |
throw "No filename supplied" | |
} | |
if(Test-Path $file) | |
{ | |
(Get-ChildItem $file).LastWriteTime = Get-Date | |
} | |
else | |
{ | |
Add-Content $file $null | |
} | |
} | |
Set-Alias touch New-File | |
# Alias for "ll" | |
Set-Alias ll ls | |
# New Console | |
function New-Console | |
{ | |
& powershell "-new_console" | |
} | |
Set-Alias newterm New-Console | |
# "Source" profile, refresh it | |
function Update-Profile | |
{ | |
.$profile | |
} | |
Set-Alias source Update-Profile | |
function Reset-Color { | |
[Console]::ResetColor() | |
} | |
Set-Alias reset-color Reset-Color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment