Open gjeusel opened 4 years ago
I like the idea!
We should support this in prompt_toolkit and then ptpython can make use of it.
I see two interesting things we can do:
Similar to the fuzzy completer that we have already (https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/prompt_toolkit/completion/fuzzy_completer.py), we can do a fuzzy history search. Pressing ctrl-r should in this case bring up the same search prompt, but the history is filtered exactly like the fuzzy completer does. This poses in interesting challenge for visualisation, but I think it can be done.
Use the real fzf in a subprocess to filter the history. We can replace the ctrl-r key binding with this. Then pipe the whole history into fzf and take the output. As far as I understand, fzf doesn't support multiline entries, so we have to pass them to fzf as a single line. Not sure, but I think this can be done without changes to prompt_toolkit itself.
I think about it, it's a very nice idea.
There is also Percol, which is written in Python: https://github.com/mooz/percol While perhaps not as fuzzy as fzf, it's a useful line selector. It can also be imported and used without needing a subprocess.
hi i just came across your tool its amazing! but with fzf it will be absolutely incomparable imho, tenx!
Hello, are there any plans to support this? It would be quite amazing If not through fzf, then as @fd2 suggested, percol is also a good python-based alternative.
Hello Mister Slenders ! I love your library and am using it daily.
I would really enjoy a new feature about browsing command history via
ctrl-r
doing anI-search backward
that makes use of fzf.This insanely useful tool has already been integrated in shells, vim and much more.
I think it might be a nice integration to have in a python repl, with potentially multi-select (which would cover the history page functionalities).
I found a python binding on github: pyfzf.
Please tell me what you think !