Skip to content

Instantly share code, notes, and snippets.

@HymanZHAN
Created April 2, 2020 17:08
Show Gist options
  • Save HymanZHAN/ccf39667188c076a587ea2e9e86b7407 to your computer and use it in GitHub Desktop.
Save HymanZHAN/ccf39667188c076a587ea2e9e86b7407 to your computer and use it in GitHub Desktop.
Powershell 7 Profile for use within WSL
# Installed Module
Import-Module posh-git
# Aliases
Set-Alias -Name ll -Value Get-ChildItem
Set-Alias -Name quit -Value exit
Set-Alias -Name code -Value '/mnt/c/Users/zhanx/AppData/Local/Programs/Microsoft VS Code/bin/code'
# Built-In PSReadLine Options
Set-PSReadLineOption -HistoryNoDuplicates
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -HistorySaveStyle SaveIncrementally
Set-PSReadLineOption -MaximumHistoryCount 4000
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -Colors @{
Selection = "`e[30;47m"
}
# Path Env Variables
$env:PATH = "/home/xzhan/miniconda3/bin/:"+ $env:PATH
$env:PATH = "/home/xzhan/.cargo/bin/:" + $env:PATH
$env:PATH = "/home/xzhan/.nvm/versions/node/v12.16.1/bin:" + $env:PATH
# Personal Functions
function mooc {
Set-Location -Path "/home/xzhan/Development/MOOC"
}
function wk {
Set-Location -Path "/home/xzhan/Development/Work"
}
function proj {
Set-Location -Path "/home/xzhan/Development/Projects"
}
function pk {
Set-Location -Path "/home/xzhan/Development/Packages"
}
function which {
param (
$command
)
Get-Command $command | Format-Table Name, Path
}
function dcud {
Invoke-Command -ScriptBlock { docker-compose up -d }
}
function dex {
param (
$service, $command
)
Invoke-Command -ScriptBlock { docker-compose exec $service $command }
}
function dcs {
Invoke-Command -ScriptBlock { docker-compose stop }
}
function dsa {
Invoke-Command -ScriptBlock { docker stop $(docker ps -q -a) }
}
Invoke-Expression (&starship init powershell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment