Last active
June 8, 2024 18:45
-
-
Save RoadToDream/d799fb837596210174829b48c4c9a71f to your computer and use it in GitHub Desktop.
PowerShell profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-PSReadLineOption -EditMode Emacs | |
Set-PSReadLineKeyHandler -Chord Ctrl+LeftArrow BackwardWord | |
Set-PSReadLineKeyHandler -Chord Ctrl+RightArrow ForwardWord | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward | |
$global:globalPromptInvokedCount = 0 | |
Function prompt() { | |
if ($global:globalPromptInvokedCount -eq 0) { | |
$global:globalPromptInvokedCount++ | |
$currentLocation = $executionContext.SessionState.Path.CurrentLocation.ToString() | |
$userHome = [Environment]::GetFolderPath("UserProfile") | |
if ($currentLocation -eq $userHome) { | |
$currentLocation = "~" | |
} else { | |
$currentLocation = Split-Path -Path $currentLocation -Leaf | |
} | |
$ESC = [char]27 | |
"$ESC[38;2;227;100;100m@jduan $ESC[0m$ESC[38;2;98;237;139m➜ $ESC[0m$ESC[38;2;86;182;194m$currentLocation$ESC[0m " | |
} elseif ($global:globalPromptInvokedCount -eq 1) { | |
oh-my-posh init pwsh --config "C:\Users\jduan\AppData\Local\Programs\oh-my-posh\themes\zash_custom.omp.json" | Invoke-Expression | |
Import-Module posh-git | |
$global:globalPromptInvokedCount++ | |
prompt | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hope this will help anyone who is also suffered from the loading time.
oh-my-posh takes a lot of time to load. #1624