Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to configure bash in such a way that on the first tab autocomplete it lists all possible files and on subsequent ones cycles through the choices?

Both options are easy to do separately and I could bind them to different keys, but the above would be perfect, but I can't find anything about it on the net.

share|improve this question
3  
It's been a while since I have used ZSH, but I believe its autocomplete functions like this. –  jordanm Nov 8 '12 at 18:07
    
@jordanm Well seems like an option if nothing else works, but that would also entail updating everything from .bashrc, etc. to the ZSH equivalents, which I'd quite like to avoid. –  Voo Nov 8 '12 at 18:34
add comment

2 Answers 2

up vote 3 down vote accepted
+100

This seems close to what you want:

bind "TAB:menu-complete"
bind "set show-all-if-ambiguous on"
share|improve this answer
1  
Almost perfect, apart from the small flaw that it also autocompletes on the first tab, which can be a bit annoying if I'm just trying to figure out the exact name (i.e. I have to delete quite a bit more characters if I want to change then), but I'm quite willing to live with that. –  Voo Nov 14 '12 at 5:38
add comment

Have you considered? It was referenced at Superuser ...

[[ $- = *i* ]] && bind TAB:menu-complete
share|improve this answer
1  
menu-complete is only half of what the question is asking. As the question says, "[b]oth options are easy to do separately". –  jw013 Nov 8 '12 at 19:18
    
Yes I know how to change the behavior to one of the two options, but that's the easy part. The real problem is how to combine the two into one. –  Voo Nov 10 '12 at 4:46
add comment

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.