The bash-completion Problem
The bash-completion package adds
a bunch of useful features, but it also limits what happens when you press tab
.
For example, the “text editor” completion excludes files that probably are not text files:
And the sqlite3 completion tries to outsmart you:
It looks only for files with an extension .sqlite, .sqlite3, .s3db, .sdb, .db.
When tab
doesn’t do what you expect, you can try to read the source. If
you aren’t sure what completions you have, try this:
The temporary fix: meta-/
But wait … isn’t bash-completion just trying to help?! Isn’t it doing the right thing most of the time?
Tab completion is awesome when it works, but it can drive you crazy when it doesn’t.
If you press tab
and nothing happens … try pressing: meta-/
(try: ESC-/
or alt-/
) to force file completion.
The permanent fix: complete -r
You can remove a specific completion manually:
or you can integrate it after you source bash-completion: (line 4 and 5)
1
2
3
4
5
6
7
8
9
10
11
12
for dir in /usr/local/etc /etc; do
if [ -e ${dir}/bash_completion ]; then
source ${dir}/bash_completion
complete -r vim
complete -r sqlite3
break
fi
done
if [ -z "$BASH_COMPLETION" ]; then
echo "no bash-completion"
fi
- it looks for bash-completion in the usual places
- it sources the first one it finds
- it removes completions I didn’t want
- it warns you if it couldn’t find it – for example, on a new machine, before you install everything you need
In the end, whether you fix the problem short-term or long-term depends on how annoying this is to you.