Skip to content

Instantly share code, notes, and snippets.



Last active Nov 9, 2020
What would you like to do?
Mac Pwsh Profile
Import-Module -Name Toolbox
Import-Module -Name Microsoft.PowerShell.UnixUtilCompleters
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
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
$gitpromptsettings.DefaultPromptAbbreviateHomeDirectory = $true
$GitPromptSettings.DefaultPromptSuffix = $('`n❯❯ ' * ($nestedPromptLevel + 1))
if ($env:LC_TERMINAL -eq "iTerm2") {
$ThemeSettings.Options.ConsoleTitle = $false
Set-Theme Powerlevel10k-Lean
$ThemeSettings.CurrentUser = $null
$ThemeSettings.PromptSymbols['promptindicator'] = ("`n{0} " -f ([char]::ConvertFromUtf32(0x276F) * 2))
# 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