readline + python + vi-editing-mode

laurence from-nabble at
Thu Oct 18 13:11:02 PDT 2012

I'm trying to enable vi editing mode in readline in Python. Here's what I'm
doing in an interactive Python session:

>>> import readline
>>> import rlcompleter
>>> readline.parse_and_bind ("bind ^I rl_complete")
>>> readline.parse_and_bind("tab: complete")
>>> readline.parse_and_bind('set editing-mode vi')

To test if it's working, I type a few words, and then tap ESC and 'b' a few
times. That should take me back word-by word. On my Linux box this works as
expected, but on my Mac with MacPorts it doesn't, and I don't understand
why. Tapping b repeatedly moves me back one word, but then starts inserting
b's, so it seems to be still in emacs mode.

I thought I might have accidentally run the Apple build of Python (I know it
has... issues with readline due to GPL), but it looks like I'm using the
MacPorts version:

>>> rlcompleter.__file__
>>> readline.__file__

Any ideas?

View this message in context:
Sent from the MacPorts - Users mailing list archive at

More information about the macports-users mailing list