You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be nice if an application built using prompt-toolkit behaves the same way as applications based on readline in that they use the input mode that is set in /etc/inputrc or ~/.inputrc.
Or do you think that the logic to detect the right keybinding should be part of the application and not within the prompt-toolkit library?
Reacted by Anton Backer, Chris Chambers, Aleksandrs Stier and Mayank Singhal
You're not the first one asking for this.
This logic should probably become part of the prompt-toolkit library.
It's not easy, but I hope to be able to do this. First, we need to decouple the key bindings from their implementation, in order to have configurable key bindings.
Then we need a way to apply the configuration from .inputrc.
This is also something I'm working toward. It will take many small steps to get there, but I hope we will eventually.
This gets requested a lot for bpython as well. If this is in the toolkit it'd be pretty cool to use that code, and I'd love to contribute to it. (Dredging up this old issue because I'm thinking about starting to write a minimal version myself, but would love to contribute to a common effort if possible.)
The next step is to parse .inputrc, then use prompt_toolkit.terminal.vt100_input.InputStream to parse the escape sequence from the file and get a list of keys back. Then we can couple these to the handlers.
Some work has been done in this direction, but my focus has been elsewhere for a long time.
However, I'd still like to make this work some day. (First, release of 2.0 ;) )
Activity
jonathanslenders commentedon Nov 5, 2014
You're not the first one asking for this.
This logic should probably become part of the prompt-toolkit library.
It's not easy, but I hope to be able to do this. First, we need to decouple the key bindings from their implementation, in order to have configurable key bindings.
Then we need a way to apply the configuration from .inputrc.
This is also something I'm working toward. It will take many small steps to get there, but I hope we will eventually.
thomasballinger commentedon Mar 10, 2015
This gets requested a lot for bpython as well. If this is in the toolkit it'd be pretty cool to use that code, and I'd love to contribute to it. (Dredging up this old issue because I'm thinking about starting to write a minimal version myself, but would love to contribute to a common effort if possible.)
mfussenegger commentedon Mar 10, 2015
We've ended up putting in this little hack here: https://github.com/crate/crash/blob/d8e49c0aec8f1c70c49fe56e7f3e967bde1f44a3/src/crate/crash/command.py#L415
doesn't work for runtime of course but better than nothing =)
jonathanslenders commentedon Mar 10, 2015
@mfussenegger
Thanks, probably I will add something like that to prompt-toolkit itself.
jonathanslenders commentedon Jul 21, 2016
I started moving many of the Emacs key bindings into a separate file, attaching them to the readline names: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/key_binding/bindings/named_commands.py
Many readline commands are still missing, but I guess we have now half of them by name.
The next step is to parse .inputrc, then use
prompt_toolkit.terminal.vt100_input.InputStreamto parse the escape sequence from the file and get a list of keys back. Then we can couple these to the handlers.westurner commentedon Aug 6, 2016
Here's a (start at) an
.inputrcparser: https://gist.github.com/westurner/0491f7e2c6d91842c3bcd3925d911ff7chrischambers commentedon Feb 6, 2017
This would be absolutely fantastic - one of my two minor gripes about switching to ipython 5 was that all my readline bindings evaporated.
y2kbugger commentedon May 13, 2018
At pycon wondering if this works yet?
jonathanslenders commentedon May 13, 2018
Some work has been done in this direction, but my focus has been elsewhere for a long time.
However, I'd still like to make this work some day. (First, release of 2.0 ;) )
asmeurer commentedon May 13, 2018
Here is the relevant code in readline https://git.savannah.gnu.org/cgit/readline.git/tree/bind.c