Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like for bash to rotate through the matching file names instead of listing them, like the default tab completion behavior in vim. Is there an easy command to do this? This is essentially the opposite of this question.

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Map Tab to menu-complete.

In your ~/.inputrc:

"\C-i": menu-complete

Re-read the file to make it effective in the current shell by pressing Ctrl-x Ctrl-r.

You can use the following command at a command prompt to enable the feature for the current session if you'd like to test it without editing the ~/.inputrc file, for example.

bind '"\C-i" menu-complete'
share|improve this answer
1  
Is there any way to make SHIFT + TAB go through the list in reverse? –  ubiquibacon Jan 7 at 14:58
    
@ubiquibacon: Generally speaking, in a terminal there's no difference between Tab and Shift + Tab (or other shifted vs. non-shifted control characters). However, you can use another keystroke to do the reverse stepping. bind '"\C-q" "\e-\C-i"' will cause Ctrl + Q to do this (or add "\C-q" "\e-\C-i" to your ~/.inputrc. You may need to add stty -ixon to your ~/.bashrc file to enable Ctrl + Q (and Ctrl + S). The \e- (Escape minus) is what reverses the direction. –  Dennis Williamson Jan 7 at 15:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.