Skip to content

Instantly share code, notes, and snippets.

Last active Jan 18, 2022
What would you like to do?
Mac Pwsh Profile
Import-Module -Name Toolbox
Import-Module -Name Microsoft.PowerShell.UnixCompleters
Import-Module -Name Terminal-Icons
function BackOne {
Set-Location ..
function BackTwo {
Set-Location ../..
function Get-NativeChildItem {
& (Get-Command ls -CommandType Application) -lhG
function Get-NativeChildItemG {
& (Get-Command ls -CommandType Application) -G
function Get-NativeChildItemA {
& (Get-Command ls -CommandType Application) -lAhG
Invoke-Expression "$(thefuck --alias)"
New-Alias -Name code -Value 'code-insiders'
New-Alias -Name '..' -Value 'BackOne'
New-Alias -Name '...' -Value 'BackTwo'
New-Alias -Name clip -Value Set-Clipboard
New-Alias -Name ll -Value Get-NativeChildItem
New-Alias -Name ls -Value Get-NativeChildItemG
New-Alias -Name la -Value Get-NativeChildItemA
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineOption -HistorySearchCursorMovesToEnd:$true
# EditorServicesCommandSuite - Only needs to load in Vscode.
if ($ -eq 'Visual Studio Code Host') {
Import-Module EditorServicesCommandSuite
Import-EditorCommand -Module EditorServicesCommandSuite
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme /Users/brett.miller/.oh-my-posh.omp.json
$env:AZ_ENABLED = $true
# Taken from here:
# Changing directories without having to type cd to replicate zsh
$ExecutionContext.InvokeCommand.CommandNotFoundAction = {
# Remove the ‘get-‘ prefix that confuses Test-Path after we produce
# something that is path like after the get-.
if ($commandName.StartsWith(get-)) {
$commandName = $commandName.Substring(4)
# If the command looks like a location, just switch to that directory
if (Test-Path -Path $commandName) {
$eventArgs.CommandScriptBlock = { Set-Location -LiteralPath $commandName }.GetNewClosure()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment