Git Product home page Git Product logo

psfzfhistory's Introduction

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.

psfzfhistory's People

Contributors

dependabot[bot] avatar kachick avatar selfup-runner[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

psfzfhistory's Issues

Module?

Validation error if PSReadLine keybind is used in *nix

Found in #2

In pwsh with installed by nix and linux, PSReadLine keybind does not work.
ScriptBlock can be register and silent and no effect.
Normal block will be validation error

PS pwsh-fzf-history> Set-PSReadLineKeyHandler -Chord UpArrow -Function Get-History-Fzf
Set-PSReadLineKeyHandler: Cannot validate argument on parameter 'Function'. The argument "Get-History-Fzf" does not belong to the set "Abort,AcceptAndGetNext,AcceptLine,AcceptNextSuggestionWord,AcceptSuggestion,AddLine,BackwardChar,BackwardDeleteChar,BackwardDeleteInput,BackwardDeleteLine,BackwardDeleteWord,BackwardKillInput,BackwardKillLine,BackwardKillWord,BackwardWord,BeginningOfHistory,BeginningOfLine,CancelLine,CapitalizeWord,CaptureScreen,CharacterSearch,CharacterSearchBackward,ClearHistory,ClearScreen,Complete,Copy,CopyOrCancelLine,Cut,DeleteChar,DeleteCharOrExit,DeleteEndOfBuffer,DeleteEndOfWord,DeleteLine,DeleteLineToFirstChar,DeletePreviousLines,DeleteToEnd,DeleteWord,DigitArgument,DowncaseWord,EndOfHistory,EndOfLine,ExchangePointAndMark,ForwardChar,ForwardDeleteInput,ForwardDeleteLine,ForwardSearchHistory,ForwardWord,GotoBrace,GotoColumn,GotoFirstNonBlankOfLine,HistorySearchBackward,HistorySearchForward,InsertLineAbove,InsertLineBelow,InvertCase,InvokePrompt,KillLine,KillRegion,KillWord,MenuComplete,MoveToEndOfLine,NextHistory,NextLine,NextSuggestion,NextWord,NextWordEnd,Paste,PasteAfter,PasteBefore,PossibleCompletions,PrependAndAccept,PreviousHistory,PreviousLine,PreviousSuggestion,Redo,RepeatLastCharSearch,RepeatLastCharSearchBackwards,RepeatLastCommand,RepeatSearch,RepeatSearchBackward,ReverseSearchHistory,RevertLine,ScrollDisplayDown,ScrollDisplayDownLine,ScrollDisplayToCursor,ScrollDisplayTop,ScrollDisplayUp,ScrollDisplayUpLine,SearchChar,SearchCharBackward,SearchCharBackwardWithBackoff,SearchCharWithBackoff,SearchForward,SelectAll,SelectBackwardChar,SelectBackwardsLine,SelectBackwardWord,SelectCommandArgument,SelectForwardChar,SelectForwardWord,SelectLine,SelectNextWord,SelectShellBackwardWord,SelectShellForwardWord,SelectShellNextWord,SelfInsert,SetMark,ShellBackwardKillWord,ShellBackwardWord,ShellForwardWord,ShellKillWord,ShellNextWord,ShowCommandHelp,ShowFullPredictionTooltip,ShowKeyBindings,ShowParameterHelp,SwapCharacters,SwitchPredictionView,TabCompleteNext,TabCompletePrevious,Undo,UndoAll,UnixWordRubout,UpcaseWord,ValidateAndAcceptLine,ViAcceptLine,ViAcceptLineOrExit,ViAppendLine,ViBackwardChar,ViBackwardDeleteGlob,ViBackwardGlob,ViBackwardWord,ViCommandMode,ViDeleteBrace,ViDeleteEndOfGlob,ViDeleteGlob,ViDeleteToBeforeChar,ViDeleteToBeforeCharBackward,ViDeleteToChar,ViDeleteToCharBackward,ViDigitArgumentInChord,ViEditVisually,ViEndOfGlob,ViEndOfPreviousGlob,ViExit,ViForwardChar,ViGotoBrace,ViInsertAtBegining,ViInsertAtEnd,ViInsertLine,ViInsertMode,ViInsertWithAppend,ViInsertWithDelete,ViJoinLines,ViNextGlob,ViNextWord,ViReplaceLine,ViReplaceToBeforeChar,ViReplaceToBeforeCharBackward,ViReplaceToChar,ViReplaceToCharBackward,ViSearchHistoryBackward,ViTabCompleteNext,ViTabCompletePrevious,ViYankBeginningOfLine,ViYankEndOfGlob,ViYankEndOfWord,ViYankLeft,ViYankLine,ViYankNextGlob,ViYankNextWord,ViYankPercent,ViYankPreviousGlob,ViYankPreviousWord,ViYankRight,ViYankToEndOfLine,ViYankToFirstChar,WhatIsKey,Yank,YankLastArg,YankNthArg,YankPop" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

https://github.com/PowerShell/PSReadLine/blob/5efe2ef55f85bbac9c8a8f39825ad62b3049b0a5/PSReadLine/Cmdlets.cs#L938-L958

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.