readline + python + vi-editing-mode

laurence from-nabble at xenomachina.com
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__
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/rlcompleter.pyc'
>>> readline.__file__
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so'

Any ideas?



--
View this message in context: http://mac-os-forge.2317878.n4.nabble.com/readline-python-vi-editing-mode-tp197263.html
Sent from the MacPorts - Users mailing list archive at Nabble.com.


More information about the macports-users mailing list