Last active
June 8, 2024 18:45
-
-
Save RoadToDream/d799fb837596210174829b48c4c9a71f to your computer and use it in GitHub Desktop.
Revisions
-
RoadToDream revised this gist
Jun 8, 2024 . 1 changed file with 10 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,15 +6,21 @@ 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 -
RoadToDream revised this gist
Jun 3, 2024 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,10 @@ Set-PSReadLineOption -HistorySearchCursorMovesToEnd Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward # This will not load oh-my-posh and posh-git module on start up, but will load after the first command # Reason for that is because oh-my-posh or posh-git takes a lot of time to load, especially for the # first time after the boot(3-5 seconds). With that we can get PowerShell ready to use instantly. $global:globalPromptInvokedCount = 0 Function prompt() { -
RoadToDream created this gist
Jun 3, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ 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++ } 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 } }