Skip to content

Instantly share code, notes, and snippets.

@unycone
Last active May 24, 2023 08:11
Show Gist options
  • Save unycone/3f4c40863ec450f996b295946b7138a9 to your computer and use it in GitHub Desktop.
Save unycone/3f4c40863ec450f996b295946b7138a9 to your computer and use it in GitHub Desktop.
Profile for Windows Powershell7 to achieve bash-like behaviors
# A config file for Windows Powershell 7
# Save this as C:\Users\{username}\Documents\Powershell\Profile.ps1
# Shows navigable menu of all options when hitting Tab
Set-PSReadlineKeyHandler -Key Tab -Function Complete
# Autocompletion for arrow keys
Remove-PSReadlineKeyHandler -Key Ctrl+y
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key Ctrl+p -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineKeyHandler -Key Ctrl+n -Function HistorySearchForward
Set-PSReadLineKeyHandler -Chord Ctrl+f -Function ForwardChar
Set-PSReadLineKeyHandler -Chord Ctrl+b -Function BackwardChar
Set-PSReadLineKeyHandler -Chord Ctrl+d -Function DeleteChar
Set-PSReadLineKeyHandler -Chord Ctrl+k -Function KillLine
Set-PSReadLineKeyHandler -Chord Ctrl+y -Function Yank
Set-PSReadlineKeyHandler -Key 'Ctrl+a' -Function BeginningOfLine
Set-PSReadlineKeyHandler -Key 'Ctrl+e' -Function EndOfLine
# New-Alias <alias> <aliased-command>
New-Alias open ii
# Silence bell sound
Set-PSReadlineOption -BellStyle None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment