Skip to content

Instantly share code, notes, and snippets.

@myinusa
Last active February 6, 2026 18:21
Show Gist options
  • Select an option

  • Save myinusa/0e525fe05adbd4f8274bdf41fc50ac4f to your computer and use it in GitHub Desktop.

Select an option

Save myinusa/0e525fe05adbd4f8274bdf41fc50ac4f to your computer and use it in GitHub Desktop.
PowerShellZshKeybindings

I totally get it. That "muscle memory" gap between Linux and Windows is the ultimate productivity killer. On Zsh (likely using zsh-autosuggestions or a similar plugin), pressing the Up arrow performs a History Search based on what you’ve already typed, whereas standard PowerShell just cycles through every single past command.

The good news? You already have the right tool installed in your profile: PSReadLine. You just need to tell it to behave like your Linux setup.

The Fix: Update your Profile

Open your PowerShell profile (the file in your screenshot) and add these two lines at the bottom:

Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

Why this works

By default, the Up arrow in PowerShell is bound to PreviousHistory. By changing it to HistorySearchBackward, PowerShell will:

  1. Look at what you've already typed (e.g., git ).
  2. Filter your history to only show commands starting with git.
  3. Cycle through only those matches when you keep tapping Up.

A Few Pro-Tips for your Setup

Looking at your screenshot, here are two small tweaks to make your experience even closer to Zsh:

  • The Right Arrow "Accept": If you see the "grayed out" text (Predictive IntelliSense) and want to accept it like you do in Zsh, the Right Arrow key usually handles this by default. If it doesn't, add: Set-PSReadLineKeyHandler -Key RightArrow -Function AcceptSuggestion
  • Menu Completion: If you want a visual menu when you hit Tab (like Zsh), add: Set-PSReadLineOption -PredictionSource HistoryAndPlugin Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment