[IPython-dev] pyreadline: getting callbacks for keypresses from pyreadline

Ville M. Vainio vivainio at gmail.com
Thu Jun 14 11:35:38 EDT 2007

Is it possible to register certain keys to certain functions that are
called when that key is pressed? I'm thinking of something like:

def my_translator(line, curpos):
  return (line +"appended", curpos)

readline.bind_translator("Alt-e", my_translator)

where my_translator returns the new content for corrent line, along
with cursor position.

This could be used e.g. to launch external editor for current command
line, something that seems to exist in Vi mode. We should rig the
IPython default editor for something like this.

Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

More information about the IPython-dev mailing list