https://github.com/kachick/psfzfhistory
Tiny fzf integration for history substring search in PowerShell
https://github.com/kachick/psfzfhistory
fzf history powershell substring-search
Last synced: about 1 year ago
JSON representation
Tiny fzf integration for history substring search in PowerShell
- Host: GitHub
- URL: https://github.com/kachick/psfzfhistory
- Owner: kachick
- License: mit
- Created: 2024-03-01T08:38:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T01:59:45.000Z (over 1 year ago)
- Last Synced: 2024-12-09T03:01:11.409Z (over 1 year ago)
- Topics: fzf, history, powershell, substring-search
- Language: PowerShell
- Homepage: https://www.powershellgallery.com/packages/PSFzfHistory
- Size: 362 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# PSFzfHistory
[](https://github.com/kachick/PSFzfHistory/actions/workflows/ci-nix.yml?query=branch%3Amain+)
[](https://github.com/kachick/PSFzfHistory/actions/workflows/release.yml?query=branch%3Amain+)
[](https://www.powershellgallery.com/packages/PSFzfHistory)
Tiny [fzf](https://github.com/junegunn/fzf) integration for history substring search in PowerShell
## Installation
### Requirements
Install [fzf](https://github.com/junegunn/fzf) with your favorite method, I prefer [winget](https://github.com/microsoft/winget-pkgs/tree/master/manifests/j/junegunn/fzf) in Windows
```pwsh
winget install --exact --id junegunn.fzf
```
### This Module
via [PowerShell Gallery](https://www.powershellgallery.com/packages/PSFzfHistory)
```pwsh
Install-Module -Name PSFzfHistory
```
via [Local modules](docs/install-from-github.md)
## Usage
Exported functions
- Invoke-FzfHistory
- Set-FzfHistoryKeybind
In typical use, add these code in your $PROFILE(Profile.ps1)
```pwsh
# 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
- https://github.com/PowerShell/PSReadLine/issues/494#issuecomment-273358367
- https://github.com/junegunn/fzf/issues/154#issuecomment-84503814
## Motivation
I really want history substring search in all shells.\
[PSFzf](https://github.com/kelleyma49/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.