3

I recently installed bash-completion (via homebrew). It now omits files in the completion list that I want it to show, and completely omits valid options, such as this:

[alex@mbp foo]$ ls bar.csv foo.csv [alex@mbp foo]$ sh ../dosomething.sh fo<TAB> ((nothing shown))

As a heavy command line user, this is extremely annoying. Can anyone tell me how to disable this behaviour? I could not find anything useful in the documentation or Google.

The bash-completion FAQ says:

Q. The bash completion code inhibits some commands from completing on files with extensions that are legitimate in my environment. Do I have to disable completion for that command in order to complete on the files that I need to?

A. No. Use M-/ to (in the words of the bash man page) attempt file name completion on the text to the left of the cursor. This will circumvent any file type restrictions put in place by the bash completion code.

But this is not an acceptable solution for me - I want "TAB" to show all files/directories regardless of whether the extension is valid for the file or not (that's how it has worked well for me for the last 20 years).

How can I achieve this?

I'd prefer a .bashrc/.bash_profile setting over deleting global completion scripts. Here is how I currently include the bash-completion (it's just a stock homebrew installation):

[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

Update: I've seen this Bash filename tab completion but it's not quite what I want, as it requires too much manual work for every possible file extension on earth/my system.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.