Steps to reproduce

git clone https://github.com/MichinariNukazawa/vecterion_vge.git
cd vecterion_vge
  1. input vim include/ tab
  2. input vim include/et_co tab

What I expected to see

  1. show file list in include/
  2. autocomplete file path vim include/et_color_panel.h

What I saw instead

Both 1. and 2. do not work.


Both ls include/ tab and ls include/et_co tab do work.

The input vim vecterion_vge/include/et_co tab on parent directory (home dir) does work.

How can I fix this?

  • Works well for me in Xubuntu 16.04 in Zsh but does not work in Bash. – Melebius Jan 30 '18 at 13:40
  • I use in Ubuntu 16.04 in bash. – michinari nukazawa Jan 30 '18 at 13:53
  • Add the output of complete -p vim, please. – muru Jan 31 '18 at 0:53
  • output is complete -F _filedir_xspec vim. – michinari nukazawa Jan 31 '18 at 13:42

Maybe you turned off the completion specifications associated with vim.

complete -p vim

And check the output:

complete -F _filedir_xspec vim

If is something like the previous line, run the command:

complete -r vim

In general, and not directly related to vim you can follow these examples, modify for your case:

First example

You can list all the current completion routines active for your user via complete -p or list all the completion included in your system: ls /etc/bash_completion.d/

Completion is drived by the file /etc/bash_completion and new completion commands may be placed inside the directory /etc/bash_completion.d

You need to enable smart completion, editing your /etc/bash.bashrc file. I think you have, because the cd Tab completion. Anyway uncomment the following lines, by removing the # in the beginning of the lines:

#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion

As you can see, everything depends on the information inside bash_completion.d file.

If you can even extend bash smart completion to your vim or apt need to edit /etc/bash_completion and /etc/bash_completion.d 

Other example

If you don't have access to edit files or add archives to /etc. You can add local completion, for example for wp-cli you can dowload the completion definition and rename to hide the command:

wget https://github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash
rename wp-completion.bash .wp-completion.bash

Now edit your .bash_profile using nano .bash_profile or vimadding this:

source /home/tu_usuario_del_host/.wp-completion.bash
| improve this answer | |
  • Thanks for your reply. But this solution is not work. – michinari nukazawa Jan 30 '18 at 23:10
  • 1. Because there was something similar to the line you pointed to in /etc/bash.bashrc, I commented out this, but it did not solve it. As another method, I copied the line you specified, but it did not solve it. 2. There was no file to be read by /etc/bash_completion. This is because you pointed out /etc /bash_completion and /etc/bash_completion.d ? – michinari nukazawa Jan 30 '18 at 23:21
  • I am sorry misunderstood. /usr/share/bash-completion/bash_completion exists. – michinari nukazawa Jan 30 '18 at 23:28
  • I'm away from my Linux computer, this evening I try to check is everything is OK. I didn't use with these commands. I only added completion for wp-cli with the following commands: wget github.com/wp-cli/wp-cli/raw/master/utils/wp-completion.bash rename wp-completion.bash .wp-completion.bash Now edit .bash_profile, nano .bash_profile adding this: source /home/tu_usuario_del_host/.wp-completion.bash – manuti Jan 31 '18 at 8:28
  • I tryed. Adding .wp-completion.bash dose not work. – michinari nukazawa Jan 31 '18 at 13:57

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.