Skip to content

Instantly share code, notes, and snippets.

@steelx
Last active April 21, 2022 15:42
Show Gist options
  • Save steelx/e896abb55d126ba95add23ba5911bb75 to your computer and use it in GitHub Desktop.
Save steelx/e896abb55d126ba95add23ba5911bb75 to your computer and use it in GitHub Desktop.
windows terminal oh-my-posh
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": false,
"osc99": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#61AFEF",
"properties": {
"prefix": " \uE5FF ",
"style": "folder"
}
}
]
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#6CA35E",
"properties": {
"prefix": " \uE718 "
}
},
{
"type": "poshgit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#0077c2"
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#906cff",
"properties": {
"prefix": " \uE235 "
}
},
{
"type": "os",
"style": "plain",
"foreground": "#26C6DA",
"background": "#546E7A",
"properties": {
"postfix": " \uE0B1",
"macos": "mac"
}
}
]
}
Import-Module posh-git
Import-Module oh-my-posh
$omp_config = Join-Path $PSScriptRoot ".\ajinkya.omp.json"
oh-my-posh --init --shell pwsh --config $omp_config | Invoke-Expression
Import-Module -Name Terminal-Icons
Set-PoshPrompt Lambda
# PSReadLine
Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineOption -BellStyle None
Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar
Set-PSReadLineOption -PredictionSource History
# Fzf
Import-Module PSFzf
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r'
# Env
$env:GIT_SSH = "C:\Windows\system32\OpenSSH\ssh.exe"
# Alias
Set-Alias -Name vim -Value nvim
Set-Alias ll ls
Set-Alias g git
Set-Alias grep findstr
Set-Alias tig 'C:\Program Files\Git\usr\bin\tig.exe'
Set-Alias less 'C:\Program Files\Git\usr\bin\less.exe'
# Utilities
function which ($command) {
Get-Command -Name $command -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
}
@steelx
Copy link
Author

steelx commented Dec 9, 2021

Install needed modules first:

Install-Module PSFzf -Scope CurrentUser -force
Install-Module posh-git -Scope CurrentUser -force
Install-Module oh-my-posh -Scope CurrentUser -force

How to load ps1 file first.

  1. type: notepad $PROFILE.CurrentUserCurrentHost
. $env:USERPROFILE\.config\powershell\user_profile.ps1
  1. reload terminal: . $PROFILE

fix restrictions
Set-ExecutionPolicy Unrestricted -scope CurrentUser

@steelx
Copy link
Author

steelx commented Apr 21, 2022

Themes can be installed at C:\Users\<USERNAME>\.config\powershell

Set-PoshPrompt -Theme atomicBit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment