I describe the problem on bash for vim, but I believe the problem is not limited to vim. First, I hit questionable autocompletion behaviour: # mkdir /tmp/bashcomp-test; cd /tmp/bashcomp-test; touch foo bar ld.so.test.conf # ls bar foo ld.so.test.conf # vim <Tab><Tab> bar foo So, no ld.so.test.conf file in the vim autocompletion output. I checked the vim-specific autocompletion file: /usr/share/bash-completion/completions/vim. It uses _filedir function when not completing an option. But it works differently: # unset COMPREPLY; cur="" _filedir ; echo "${COMPREPLY[@]}" bar ld.so.test.conf foo But then it seems that the vim-specific autocompletion is not actually used: # complete | grep vim complete -F _filedir_xspec rvim complete -F _filedir_xspec gvim complete -o filenames -F _vim vix complete -o filenames -F _vim vim complete -F _filedir_xspec rgvim complete -o filenames -F _vim vi The source for these generic rules is at /usr/share/bash-completion/bash_completion: _install_xspec '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite But then after doing the following: # complete -r vim # complete | grep vim complete -F _filedir_xspec rvim complete -F _filedir_xspec gvim complete -F _filedir_xspec rgvim # vim <Tab> <Tab> bar foo ld.so.test.conf # complete | grep vim complete -o filenames -F _vim rview complete -o filenames -F _vim rvim complete -F _filedir_xspec gvim complete -o filenames -F _vim view complete -o filenames -F _vim vim complete -o filenames -F _vim ex complete -F _filedir_xspec rgvim complete -o filenames -F _vim vi complete -o filenames -F _vim vimdiff So what happens is that we have a generic completion via _filedir_xspec, which blocks _vim() from loading. But with _filedir_xspec manually removed, _vim() is loaded on the first use. Thus, it looks like app-specific completion is not working as expected and might be blocked by default completion rules. Installed packages: =app-shells/bash-completion-2.7-r2 =app-editors/vim-8.0.1428
Thanks for doing the research. This is something that needs to be addressed upstream, though. Would you like to file a bug upstream [1] yourself, or should I proxy for you? [1]:https://github.com/scop/bash-completion/issues
> Would you like to file a bug upstream [1] yourself, or should I proxy for you? Oh, for some reason I was pretty sure this is a gentoo-specific project. I filed a new bug in the upstream (see $URL).
Thanks a lot. I'm subscribed to the issue now. Upstream is quite responsive, so we can expect some answer soon-ish.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddcca142e8aeffdba8a5a40d886f3f8254252be4 commit ddcca142e8aeffdba8a5a40d886f3f8254252be4 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2018-03-11 15:32:44 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2018-03-11 15:56:14 +0000 app-shells/bash-completion: Remove implicit completions for vim Closes: https://bugs.gentoo.org/649986 .../bash-completion/bash-completion-2.7-r3.ebuild | 132 +++++++++++++++++++++ .../bash-completion/bash-completion-9999.ebuild | 6 + 2 files changed, 138 insertions(+)