PowerShell bind arrow keys to command history search PowerShell bind arrow keys to command history search powershell powershell

PowerShell bind arrow keys to command history search


Add the following lines to your Powershell profile.

Mine is at %HOME%\Documents\WindowsPowerShell\profile.ps1.

# Reverse SearchSet-PSReadLineOption -HistorySearchCursorMovesToEndSet-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackwardSet-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

These are sourced from the powershell PSReadLine repo.

Funnily enough, we came to ask the same question 12 hours apart :)