9

The sequences control+r and fn+delete that used to do recursive search / delete the following character do not work anymore in python 2.7 / Mac OSX Lion. Instead, a ~ appears each time I use fn+delete. I am using readline for tab completion (which also had to be changed according to python tab completion Mac OSX 10.7 (Lion)). Any ideas how to fix it?

Thanks, Bruno

Community
  • 1
  • 1
Bruno Lenzi
  • 169
  • 1
  • 2

2 Answers2

3

According to http://pypi.python.org/pypi/readline:

"Mac OS X, do not ship with GNU readline installed. The readline extension module in the standard library of Mac "system" Python uses NetBSD's editline (libedit) library instead, which is a readline replacement with a less restrictive software license."

So, you can install it with the command:

sudo easy_install readline

Else, you can use tcsh shortcuts; control + d to delete the following character and Ecp + p for history search.

Faruk Sahin
  • 8,406
  • 5
  • 28
  • 34
1

For recursive search you can configure libedit by adding following line to ~/.editrc

bind ^R em-inc-search-prev

or right from your .pystartup file

readline.parse_and_bind("bind ^R em-inc-search-prev")
Rafa Viotti
  • 9,998
  • 4
  • 42
  • 62
Sasha P.
  • 11
  • 1