Skip to content

detect key-bindings from .inputrc #56

Open

Description

@mfussenegger

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?

Activity

  1. jonathanslenders commented on Nov 5, 2014

    @jonathanslenders
    Member

    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.

  2. thomasballinger commented on Mar 10, 2015

    @thomasballinger

    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.)

  3. mfussenegger commented on Mar 10, 2015

    @mfussenegger
    ContributorAuthor
  4. jonathanslenders commented on Mar 10, 2015

    @jonathanslenders
    Member

    @mfussenegger
    Thanks, probably I will add something like that to prompt-toolkit itself.

  5. jonathanslenders commented on Jul 21, 2016

    @jonathanslenders
    Member

    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.InputStream to parse the escape sequence from the file and get a list of keys back. Then we can couple these to the handlers.

  6. chrischambers commented on Feb 6, 2017

    @chrischambers

    This would be absolutely fantastic - one of my two minor gripes about switching to ipython 5 was that all my readline bindings evaporated.

  7. y2kbugger commented on May 13, 2018

    @y2kbugger

    At pycon wondering if this works yet?

  8. jonathanslenders commented on May 13, 2018

    @jonathanslenders
    Member

    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 ;) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions