Skip to content

Instantly share code, notes, and snippets.

@trmaphi
Last active March 31, 2019 10:51
Show Gist options
  • Save trmaphi/0c9c6858d944127c8ad75f5e6cd60c79 to your computer and use it in GitHub Desktop.
Save trmaphi/0c9c6858d944127c8ad75f5e6cd60c79 to your computer and use it in GitHub Desktop.
[Powershell Profile setup] My personal Powershell profile setup location #powershell
# Import module on shell
Import-Module posh-git
# Chocolatey tab completion
Import-Module “$env:ChocolateyInstall\helpers\chocolateyProfile.psm1”
# Function for load Developer Command Prompt for VS 2017 executables, Community Edition
function Load-VSDev {
Push-Location "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
ForEach-Object {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
Pop-Location
Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow
}
# Load docker and exit git bash
function Load-Docker {
Start-Process -FilePath "C:\Program Files\Git\bin\bash.exe" -ArgumentList "--login -i 'C:\Program Files\Docker Toolbox\start.sh' && exit"
# "C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh"
}
# Load dotnet tab completion
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment