New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding fuzzy history search to IPython #12231
Comments
Thanks for your question and the work you did, apologies my response is going to be a bit terse, but I'll try to come back to it later if you haven't figured it out The CLI use Python Prompt toolkit for most shortcut and UI, so some documentation can be found there. IPython/terminal/shortcuts.py is the file that handle shortcuts. Here is some docs about shortcuts (though it might be a bit old). https://ipython.readthedocs.io/en/stable/config/details.html#keyboard-shortcuts You will see in IPython/terminal/interactiveshell.py ~line 314:
That we pass the history to prompt toolkit, so I'm quasi-sure that history searching is handled by prompt toolkit, you might find more informations there. As you will see prompt toolkit is not readline so might not work with the |
@ NightMachinary The idea is good - so good that someone had https://github.com/tbxy09/ipython_plugin Have you tried this plugin? |
@GHPS I will take a look at it. |
I implemented fzf history integration a while ago: https://github.com/infokiller/config-public/blob/master/.config/ipython/profile_default/startup/ext/fzf_history.py It supports preview with syntax highlighting via Pygments, selecting multiple commands, multi-line commands, and maybe other stuff. |
This post has a great script for this, including multi-line fzf search. Here's the full script in my dotfiles. |
I have cobbled up the following:
Example usage:
Now I have these problems:
list(gethistf())
?widget
thing, e.g.,CTRL+r
will callmyfunction
with the current line's contents.)The text was updated successfully, but these errors were encountered: