Readline -- cannot bind to both Ctrl-tab and tab at the same time?
Steven D'Aprano
steve at pearwood.info
Sun Jun 28 14:55:37 EDT 2015
I'm trying to use a readline binding for both TAB and Ctrl-TAB, but it's not
working for me. Whichever I install second seems to over-ride the first.
In the Python interactive interpreter under Linux, enter these two lines:
import readline
readline.parse_and_bind('Control-tab: "import"')
Then on the next line, press Ctrl-TAB and readline should insert the
word "import". You don't need to import anything, that's just to prove that
the binding works.
Now enter:
readline.parse_and_bind('tab: "raise"')
and on the next line, press TAB and readline should insert the word "raise".
Again, no need to raise anything.
Try Ctrl-TAB again, and you'll get "raise" instead of "import".
Can anyone else replicate this issue?
Is this a Python issue, a problem with the terminal I am using, or readline
in general?
I have also tried with the alternate syntax:
readline.parse_and_bind(r'"\C-\t": "import"')
but it just silently fails to install the binding at all.
Can anyone else successfully bind two different functions to TAB and
Ctrl-TAB?
--
Steven
More information about the Python-list
mailing list