Skip to content

Instantly share code, notes, and snippets.

@worldspawn
Created May 13, 2018 02:58
Show Gist options
  • Save worldspawn/9a7b54b17e087c1eb8dc93a74ad47893 to your computer and use it in GitHub Desktop.
Save worldspawn/9a7b54b17e087c1eb8dc93a74ad47893 to your computer and use it in GitHub Desktop.
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
#. (Resolve-Path "$env:github_posh_git\install.ps1")
# Load posh-git example profile
. "$env:github_posh_git\profile.example.ps1"
$env:Path="$env:Path;C:\Users\critc\AppData\Local\Yarn\config\global\node_modules\.bin"
#add sdk to path
$winsdkpath = "$env:PROGRAMFILES\Microsoft SDKs\Windows\v6.0A\bin"
##octotools baby yeh!
#$octotoolspath = "$env:HOME\Tools\OctopusTools.2.5.4.35"
$sevenzippath = "$env:PROGRAMFILES\7-Zip"
$rubyPath = "C:\Ruby22-x64\bin"
$env:Path = "$env:Path;$sevenzippath;$rubyPath"
#$devenv2013 = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
$devenv2015 = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
$devenv2017 = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
$sourcePath = "$env:HomeDrive$env:HomePath\Source"
$sublime = "C:\Program Files\Sublime Text 3\sublime_text.exe"
$vscode = "${Env:ProgramFiles(x86)}\Microsoft VS Code\Code.exe"
$iisexpress = "${Env:ProgramFiles(x86)}\IIS Express\iisexpress.exe"
$dotnet = "$env:PROGRAMFILES\dotnet\dotnet.exe"
$webstorm = "$env:PROGRAMFILES\JetBrains\WebStorm 2017.2.5\bin\webstorm64.exe"
#$terraform = "~\terraform.exe"
# $az = "~\appdata\Roaming\Python\Scripts\az.bat"
. ~\source\rateit-utility\scripts\ps\bindings.ps1
#$terraform = "c:\tools\terraform\terraform.exe"
#$packer = "c:\tools\packer\packer.exe"
#function packer {
#. "$packer" @args
#}
# function az {
# . "$az" @args
# }
# function terraform {
# . "$terraform" @args
# }
function webstorm {
. "$webstorm" @args
}
function vsc {
. "$vscode" @args
}
function sublime {
. "$sublime" @args
}
function vs {
. "$devenv2017" @args
}
function dotnet {
. "$dotnet" @args
}
# vs legacy
function vsl {
. "$devenv2015" @args
}
function iisexpress {
. "$iisexpress" @args
}
function go {
param([string]$location = "source")
switch ($location) {
"source" { cd ~/Source }
}
if ($location.StartsWith("p:")){
$project = $location.SubString(2)
cd ~/Source/$project
}
}
$Completion_GoProject = {
param($commandName, $parameterName, $wordToComplete, $commandAst)
if ($commandName -ne "go"){
return $null
}
if ($wordToComplete.StartsWith("p:", 1) -ne $true){
return $null
}
$startsWith = $wordToComplete.Substring(2)
$x = Get-ChildItem $sourcePath | ?{ $_.PSIsContainer -and ($startsWith.Length -eq 0 -or $_.Name.StartsWith($startsWith, 1))} |
ForEach-Object {
New-Object System.Management.Automation.CompletionResult ('{0}{1}' -f $wordToComplete, $_.Name.Substring($startsWith.Length)), $_.Name, 'ParameterValue', ('{0} ({1})' -f "Part1", "Part2")
}
return $x
}
if (-not $global:options) { $global:options = @{CustomArgumentCompleters = @{};NativeArgumentCompleters = @{}}}
$global:options['CustomArgumentCompleters']['location'] = $Completion_GoProject
$function:tabexpansion2 = $function:tabexpansion2 -replace 'End\r\n{','End { if ($null -ne $options) { $options += $global:options} else {$options = $global:options}'
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
# Reset color, which can be messed up by Enable-GitColors
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
$path = $pwd.ProviderPath.Replace($env:HOME.Substring(0, $env:HOME.length), "~")
Write-Host($path) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment