reverse-menu-complete in bash
Shag helped me add reverse-menu-complete to my bash setup. It’s really easy, but undocumented. To get shift-TAB to menu-complete backwards, add the following line to your .inputrc:
\C-y:"\M--\C-i"
The \M– is actually a -1 argument to menu-complete (aka TAB, aka Ctrl-I). The info for Readline arguments describes how to pass numeric args to readline commands.
Reverse-menu-complete is useful to me since I have a FingerWorks keyboard with gestures for tab and shift-tab. The gesture stuff saves a ton of typing, which is good if you have RSI.
Here is my full .inputrc:
\C-y:"\M--\C-i"
TAB: menu-complete
set completion-ignore-case On
Filed under: no code |
Tagged: commandline , multitouch

This is such a useful tip! - shame it does not work here… :-((
I can type Alt+- and Ctrl+i manually and it works.
But using the above entry in my inputrc I always get a question mark printed out when using Ctrl-y.
I am using debian etch with libreadline5-5.1-7 and bash-3.1-5.
Any hints how to get it work would be very much appreciated, thanks!
Hmmm… are you logged in at console or through a terminal? If you are using a terminal, check the ‘alt sends meta’ setting in your terminal program.
You can use ‘xev’ to debug keypress events, which might help.
I suspect your problem might be due to the way your terminal program is mapping Alt to meta, but am a little unsure why it’s not working for you.. I wonder if ‘M–’ (two minus signs there) is actually entering a -1 arg in your case.
Using “\e” to invoke the escape key (which is how the meta sequence is invoked on my non-meta-key-having keyboard)instead of “\M-” works for me:
“\e[Z”: “\e-1\C-i”
Thx Ryan!
That really helped me out. :)
Thanks rajbot and Ryan. (Ryan’s version worked for me).
Not having that was driving me nuts!