2

Not knowing why, but the bash completion won't work if I call application in the absolute path.

For example, I have file1 & file2 under the current directory

[zhengw@localhost ~]$ rm -f file<tab><tab>
file1  file2
[zhengw@localhost ~]$ which rm
/bin/rm
[zhengw@localhost ~]$ /bin/rm -f file<tab><tab>

In the above example, bash auto completed the files for me in the first command, but returned nothing for the second command.

Also tried other commands, it turns out if I use the absolute path, the bash completion just won't work.

  • You didn't delete file1 & file2 before running second command? – αғsнιη Oct 12 '17 at 13:00
  • Which distribution, version and kernel version do you use? – cezar Oct 12 '17 at 13:14
  • CentOS 6.6, Bash v4.1.2. Note this is a company IT distributed vm, not knowing any customization they might have done to it. – wayne zheng Oct 13 '17 at 3:16
  • No, I didn't delete those files. – wayne zheng Oct 13 '17 at 3:18
3

So I've nailed the root cause. I installed the fzf application for my vim to use its' fuzzy searching function. The default installation method of fzf vim plugin installed a bash completion script which was sourced into the bashrc file, and it eventually messed up with the original completion function.

I was able to fix the problem by uninstall the plugin, and reinstall it with --bin option.

Solution:

Change the install method of fzf plugin(in your .vimrc) from:

Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all' }

to:

Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --bin' }
  • My experience with bash completion scripts is that they are well intentioned but typically so broken and unpredictable in practice that I just disable them completely. E.g. many of them disable filename completion in contexts where you want to enter a filename. – user1998586 Oct 13 '17 at 7:02
  • Hi Wayne, you should accept this answer (click on the check mark) so that the question is marked as answered. – Anthony Geoghegan Oct 16 '17 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.