Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stephaned68/ed7bd81b353754627731678680549f93 to your computer and use it in GitHub Desktop.
Save stephaned68/ed7bd81b353754627731678680549f93 to your computer and use it in GitHub Desktop.
My Powershell profile (code $PROFILE) with Oh-My-Posh, Terminal-Icons, PSReadLine and Zoxide
# Oh-My-Posh
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/takuya.omp.json" | Invoke-Expression
# Import Modules
Import-Module posh-git
Import-Module Terminal-Icons
Import-Module PSReadLine
Import-Module z
# Set Modules Options
Set-PSReadLineOption -PredictionViewStyle ListView
# Set Aliases
Set-Alias -Name ll -Value ls
Set-Alias -Name np -Value notepad.exe
Set-Alias -Name g -Value git
Set-Alias -Name gts -Value Git-Status
Set-Alias -Name gta -Value Git-Add
Set-Alias -Name gtc -Value Git-Commit
Set-Alias -Name gtp -Value Git-Push
# For zoxide v0.8.0+
Invoke-Expression (& {
$hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
(zoxide init --cmd cd --hook $hook powershell | Out-String)
})
# define functions for aliases
function Git-Status() {
git status
}
function Git-Add([string]$what) {
git add $what
}
function Git-Commit([string]$message) {
git commit -m "$message"
}
function Git-Push() {
git push
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment