PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Using Forward/ReverseSearchHistory and fuzzy matching across entire history entry

Open frizop opened this issue 11 years ago • 5 comments

Is it possible to use forward or reverse search history with a bit of fuzzy logic? Also, is it possible to do partial matches across the entire line? I ask because in zsh I'll often search for the first command and then part of the rest of the command, consider the following:

get-history

1 telnet example.com 25 2 telnet example.com 3389 3 telnet example.com 80

ReverseSearchHistory

telnet 25

the last command would match the first history id, currently it fails the backwards check.

frizop avatar Jan 29 '14 19:01 frizop

Maybe not quite what you're asking, but I had considered using a regex or wildcard search instead of a simple "starts with".

Do you know of any documentation on how zsh does it's fuzzy search? I read most of the zle documentation and don't recall seeing this capability.

lzybkr avatar Jan 29 '14 21:01 lzybkr

You know, after reviewing this a little more, maybe I'm just crazy. It doesn't seem to work the way I remembered.

As far as the fuzzy logic: see the docs here: http://arcib.dowling.edu/cgi-bin/info2html?(zsh)Control%2520Functions under the function _approximate

frizop avatar Jan 30 '14 00:01 frizop

I'll leave this open because I think I'd like regex or wildcard matching.

You can open an issue here https://github.com/lzybkr/TabExpansionPlusPlus to request fuzzy expansion.

lzybkr avatar Jan 30 '14 19:01 lzybkr

To add to this, I would really like to see smth like cd C:\us\ba\de to expand into cd C:\Users\bazzilic\Desktop when I hit <Tab>.

bazzilic avatar Aug 14 '15 10:08 bazzilic

Have you guys checked PSFzf? https://github.com/kelleyma49/PSFzf it's a module for adding FZF capabilities for PowerShell (such as changing the current folder or navigating the history interactively with FZF).

I used it all the time before the predition feature, and I still resort to it whenever I need to come back to a command which I remember just vaguely.

thomazmoura avatar Sep 13 '22 02:09 thomazmoura