I’m using bash-completion-20081219-r1 currently. When I type vim and hit <tab> for the bash completion, it gives an error:

gentoo [~] -pigfoot- [W1] vim [Hit Tab]
  vim bash: _filedir: command not found

However, I only enable “vim” and “mercurial” module for the bash completion:

gentoo [~] -pigfoot- [W1] eselect bashcomp list
Available completions:
  [1]   _subversion
  [2]   apache2ctl
  [3]   base
  [4]   bitkeeper
  [5]   bittorrent
  [6]   cksfv
  [7]   clisp
  [8]   dsniff
  [9]   eselect
  [10]  freeciv
  [11]  gcl
  [12]  genkernel
  [13]  gentoo
  [14]  gkrellm
  [15]  gnatmake
  [16]  gpg2
  [17]  harbour
  [18]  isql
  [19]  larch
  [20]  lilypond
  [21]  lisp
  [22]  mailman
  [23]  mcrypt
  [24]  mercurial *
  [25]  modules
  [26]  monodevelop
  [27]  mtx
  [28]  p4
  [29]  povray
  [30]  qdbus
  [31]  ri
  [32]  sbcl
  [33]  siege
  [34]  sitecopy
  [35]  snownews
  [36]  ssh
  [37]  subversion
  [38]  unace
  [39]  unrar
  [40]  vim *
  [41]  xxd

So I check global setting by adding –global argument:

gentoo [~] -pigfoot- [W1] eselect bashcomp list --global
Available completions:
  [1]   _subversion
  [2]   apache2ctl
  [3]   base
  [4]   bitkeeper
  [5]   bittorrent
  [6]   cksfv
  [7]   clisp
  [8]   dsniff
  [9]   eselect
  [10]  freeciv
  [11]  gcl
  [12]  genkernel
  [13]  gentoo *
  [14]  gkrellm
  [15]  gnatmake
  [16]  gpg2
  [17]  harbour
  [18]  isql
  [19]  larch
  [20]  lilypond
  [21]  lisp
  [22]  mailman
  [23]  mcrypt
  [24]  mercurial
  [25]  modules
  [26]  monodevelop
  [27]  mtx
  [28]  p4
  [29]  povray
  [30]  qdbus
  [31]  ri
  [32]  sbcl
  [33]  siege
  [34]  sitecopy
  [35]  snownews
  [36]  ssh
  [37]  subversion
  [38]  unace
  [39]  unrar
  [40]  vim
  [41]  xxd

That shows my system is only enabling “gentoo” module.

The reason is the _filedir function is defined in the “base” module for bash completion but it is not enabled by default. The “vim” module calls _filedir which is undefined so that it leads to the error.

The solution is enabling “base” module as well:

eselect bashcomp enable base

Of course, enables “base” module globally:

sudo eselect bashcomp enable --global base

Popularity: 11% [?]