Thursday, 14 February 2019

linux - Is there a way to make bash more TAB friendly?


I use bash on both my Mac and as my cygwin shell. Overall, I'm quite pleased with it.


My one complaint however is that its TAB completion isn't as good as Windows Command Line TAB completion.


For example, if there are two files with the same prefix, then bash just beeps at me when I try to TAB complete. If I keep nailing TAB, then it will eventually show me a list of potential files.


I definately prefer how Windows will cycle through potential files right on the command line.


Is there a way to get bash to operate similar to Windows Command Line in this regard?


If there isn't (I do not want to switch shells), am I missing something about TAB completion in bash? Is there a more efficient way to use it?



Answer



To get the ‘cycle through possible completions’ behavior, copy the following into an appropriate place in your .bashrc file:


[[ $- = *i* ]] && bind TAB:menu-complete

Also, bash-completion provides many extra kinds of completion besides just pathname completion. For example, menu-complete works fine with Git's bash-completion module to complete command names, option names, etc.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...