Skip to content

kachick/PSFzfHistory

Repository files navigation

PSFzfHistory

CI - Nix Status Release PSGallery Version

Tiny fzf integration for history substring search in PowerShell

Installation

Requirements

Install fzf with your favorite method, I prefer winget in Windows

winget install --exact --id junegunn.fzf

This Module

via PowerShell Gallery

Install-Module -Name PSFzfHistory

via Local modules

Usage

Exported functions

  • Invoke-FzfHistory
  • Set-FzfHistoryKeybind

In typical use, add these code in your $PROFILE(Profile.ps1)

# Make sure the winget tools in your PATH
# https://github.com/microsoft/winget-cli/issues/2498#issuecomment-1553863082
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

Set-FzfHistoryKeybind -Chord Ctrl+r

Limitations

Multiline history may be unuseful behavior in fzf

Motivation

I really want history substring search in all shells.
PSFzf is a helpful project, but the module loading speed is much slow for me.
I noticed I really want integrations only around history, unnecessary for file finders, and we may realize it with tiny PowerShell code.