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.

4
  • You didn't delete file1 & file2 before running second command? Oct 12, 2017 at 13:00
  • Which distribution, version and kernel version do you use?
    – cezar
    Oct 12, 2017 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. Oct 13, 2017 at 3:16
  • No, I didn't delete those files. Oct 13, 2017 at 3:18

1 Answer 1

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' }
2
  • 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. Oct 13, 2017 at 7:02
  • Hi Wayne, you should accept this answer (click on the check mark) so that the question is marked as answered. Oct 16, 2017 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .