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
# Certains console exes have a tendency to bork the console colors - looking at you | |
# MSBuild.exe. Either copy/paste this into your profile.ps1 file or dot source it. | |
$script:origBgColor = $host.ui.rawui.BackgroundColor | |
$script:origFgColor = $host.ui.rawui.ForegroundColor | |
function Reset-Colors | |
{ | |
$host.ui.rawui.BackgroundColor = $origBgColor | |
$host.ui.rawui.ForegroundColor = $origFgColor | |
} |
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
# Other hosts (ISE, ConEmu) don't always work as well with PSReadLine. | |
# Also, if PS is run with -Command, PSRL loading is suppressed. | |
$psrlMod = Get-Module PSReadLine | |
if (($null -eq $psrlMod) -or ($host.Name -eq 'Windows PowerShell ISE Host')) { | |
return | |
} | |
elseif ($psrlMod.Version.Major -lt 2) { | |
throw "PSReadLine 1.x installed or not imported, import PSRL or ugprade to at least 2.x." | |
} |
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
{ | |
"Condition statement": { | |
"prefix": "cond", | |
"body": [ | |
"$1 { $0; break }" | |
], | |
"description": "Switch condition statement" | |
}, | |
"Condition single quoted string statement": { | |
"prefix": "condsqstr", |
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
# This is a PSake script that supports the following tasks: | |
# clean, build, test and publish. The default task is build. | |
# | |
# The publish task uses the Publish-Module command to publish | |
# to either the PowerShell Gallery (the default) or you can change | |
# the $Repository property to the name of an alternate repository. | |
# | |
# The test task invokes Pester to run any Pester tests in your | |
# workspace folder. Name your test scripts <TestName>.Tests.ps1 | |
# and Pester will find and run the tests contained in the files. |
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
<# | |
.SYNOPSIS | |
Optimizes your PSReadline history save file. | |
.DESCRIPTION | |
Optimizes your PSReadline history save file by removing duplicate | |
entries and optionally removing commands that are not longer than | |
a minimum length | |
.EXAMPLE | |
C:\PS> Optimize-PSReadlineHistory | |
Removes all the duplicate commands. |
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
<# | |
.SYNOPSIS | |
Sets the console settings to the specified values and color theme. | |
.DESCRIPTION | |
Sets the console settings to the specified values and color theme. | |
.EXAMPLE | |
C:\PS> Configure-ConsoleSettings -Theme ConEmu -WindowSize 120,50 ` | |
-FontFace Consolas -FontSize 12 | |
Sets the colors to those used in ConEmu and sets the font and window size. |
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
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) { | |
Set-Alias nano 'C:\Program Files\Git\usr\bin\nano.exe' | |
Set-Alias vim 'C:\Program Files\Git\usr\bin\vim.exe' | |
} | |
# Edition/platform specific configuration | |
if ($IsWindows) { | |
$env:PAGER = 'less -Ps"Page %db?B of %D:.\. Press h for help or Q to quit\."' | |
if ($PSVersionTable.PSEdition -eq 'Desktop') { | |
$PSDefaultParameterValues['Get-Help:Full'] = $true |
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
# More gitconfig goodness here - https://gist.github.com/tdd/470582 | |
git config --global user.name "Keith Hill" | |
git config --global user.email <email here> | |
git config --global core.editor '\"C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd\" --new-window --wait' | |
git config --global core.autocrlf true | |
git config --global pull.ff only | |
git config --global pull.rebase true | |
git config --global rebase.autoStash true |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ "key": "alt+n", "command": "explorer.newFile" }, | |
{ "key": "alt+shift+s", "command": "PowerShell.InvokeRegisteredEditorCommand", | |
"args": { "commandName": "ConvertToSplatExpression" }, | |
"when": "editorLangId == 'powershell'" }, | |
{ "key": "ctrl+shift+q", "command": "workbench.action.toggleMaximizedPanel" }, | |
{ "key": "ctrl+shift+s", "command": "workbench.action.files.saveAll" }, | |
{ "key": "ctrl+shift+t", "command": "workbench.action.tasks.test" }, | |
{ "key": "ctrl+alt+t", "command": "workbench.action.tasks.runTask" }, |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"debug.toolBarLocation": "docked", | |
"diffEditor.ignoreTrimWhitespace": true, | |
"editor.codeLens": true, | |
"editor.detectIndentation": false, | |
"editor.dragAndDrop": false, | |
"editor.renderWhitespace": "none", |
OlderNewer