Last active
October 2, 2022 19:36
-
-
Save d-e-v-esh/88ca42499dd9b4f196dd33eda5191e30 to your computer and use it in GitHub Desktop.
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 PowerShell to UTF-8 | |
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding | |
# Icons | |
Import-Module -Name Terminal-Icons | |
# Posh Theme | |
oh-my-posh init pwsh --config 'C:/Users/Devesh/devesh.omp.json' | Invoke-Expression | |
Set-PSReadlineOption -PredictionSource History | |
Get-PSReadlineOption | % PredictionSource | |
# Shows navigable menu of all options when hitting Tab | |
# Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
# Autocompletion for arrow keys | |
Set-PSReadLineOption –HistoryNoDuplicates:$True | |
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward | |
$PSReadLineOptions = @{ | |
# EditMode = "Vi" | |
HistoryNoDuplicates = $true | |
HistorySearchCursorMovesToEnd = $true | |
Colors = @{ | |
"Command" = "#fe8019" | |
} | |
} | |
Set-PSReadLineOption @PSReadLineOptions | |
# Keeps short and simple commands out of history | |
$addToHistoryHandler = { | |
Param([string]$line) | |
if ($line.Length -le 3) { | |
return $false | |
} | |
if (@("exit","dir","ls","pwd","cd ..", "yarn").Contains($line.ToLowerInvariant())) { | |
return $false | |
} | |
return $true | |
} | |
Set-PSReadlineOption -AddToHistoryHandler $addToHistoryHandler | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment