Skip to main content

Bash completion won't work if calling application with the absolute path [Resolved]

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
file1  file2
[zhengw@localhost ~]$ which rm
/bin/rm
[zhengw@localhost ~]$ /bin/rm -f file

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.


Question Credit: wayne zheng
Question Reference
Asked October 16, 2017
Posted Under: Unix Linux
39 views
1 Answers

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' }

credit: wayne zheng
Answered October 16, 2017
 
Hi Anthony, thanks for the reminder. – wayne zheng 1 hour ago
 CanDoerz  1 month ago
 
Hi Wayne, you should accept this answer (click on the check mark) so that the question is marked as answered. – Anthony Geoghegan 6 hours ago
 CanDoerz  1 month ago
 
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 2 days ago
 CanDoerz  1 month ago
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA