Created
December 17, 2019 08:43
-
-
Save margani/0fe01b1d711753322ef04b8a4cc38179 to your computer and use it in GitHub Desktop.
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
$env:HOME=$env:HOMESHARE | |
if ((Test-Path $env:HOME) -and (!($env:HOME.contains(':')))){ | |
$DriveLetter = $env:HOMEDRIVE.replace(':','') | |
New-PSDrive -Name $DriveLetter -PSProvider FileSystem -Root $($env:HOMESHARE) | out-null | |
} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} | |
Install-Module -Name 'Get-ChildItemColor' -AllowClobber | |
Install-Module posh-git -Scope CurrentUser | |
Install-Module oh-my-posh -Scope CurrentUser | |
# Ensure posh-git is loaded | |
Import-Module -Name posh-git | |
# Ensure oh-my-posh is loaded | |
Import-Module -Name oh-my-posh | |
# Ensure that Get-ChildItemColor is loaded | |
Import-Module Get-ChildItemColor | |
# Set l and ls alias to use the new Get-ChildItemColor cmdlets | |
Set-Alias l Get-ChildItemColor -Option AllScope | |
Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope | |
# Helper function to set location to the User Profile directory | |
function cuserprofile { Set-Location ~ } | |
Set-Alias ~ cuserprofile -Option AllScope | |
# Helper function to show Unicode character | |
function U | |
{ | |
param | |
( | |
[int] $Code | |
) | |
if ((0 -le $Code) -and ($Code -le 0xFFFF)) | |
{ | |
return [char] $Code | |
} | |
if ((0x10000 -le $Code) -and ($Code -le 0x10FFFF)) | |
{ | |
return [char]::ConvertFromUtf32($Code) | |
} | |
throw "Invalid character code $Code" | |
} | |
# Start SshAgent if not already | |
# Need this if you are using github as your remote git repository | |
if (! (ps | ? { $_.Name -eq 'ssh-agent'})) { | |
Start-SshAgent | |
} | |
# Default the prompt to agnoster oh-my-posh theme | |
Set-Theme Avit | |
$ThemeSettings.Colors.PromptForegroundColor="Blue" | |
Set-Location e:\dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment