0

How come the filename auto-completion works for ls command but not for vi in my Ubuntu 16.04.5 LTS? (Xfce4, bash). I think it used to work but not now.

From Matthieu's answer below, I tried the below. Hi, thanks, I followed your example link and followed Louis Soulez's answer. But still, the auto completion doesn't work correctly for Vi. It auto-completes to some degree, but when I don't give the start pattern at a directory entrance, it gives me no list of that directory.

My other Ubuntu machine doesn't have /etc/bash_completion.d/vi file but auto-completion works well to the end for Vi. By the way, the list of files under /etc/bash_completion.d in this other Ubuntu system is:

apport_completion desktop-file-validate libreoffice.sh axi-cache dkms ninja bazel gem1.9.1 pon cmake git-prompt pulseaudio-bash-completion.sh cpack grub ufw ctest initramfs-tools upstart debconf insserv

What of these could affect the completion for Vi? Do you have any other idea?

  • Maybe vim or gvim? File autocompletion shouldn't need settings; only parameters. I'll check my setup when I'm at work. – Matthieu Oct 8 '18 at 7:26
  • looks like vi itself does the job. after I reboot the computer, vi auto-completion works now. BTW, while trying to solve this, I mistakenly deleted 4 or 5 files under /etc/bash_completion.d. Do you know by any chance how I can recover the files? (I deleted insserv, libreoffice.sh and ninja.) sorry to bother.. and thank you. – Chan Kim Oct 8 '18 at 8:58
  • unfortunately there are limited ways to undelete files on an ext4. Try to get it from another Ubuntu somewhere (or from another installation on a VM). I have insserv and libreoffice.sh, but no ninja. – Matthieu Oct 8 '18 at 9:28
  • 1
    @Matthieu I thought the same, but strangely, without those files, and after commenting out the 'enable programmable completion ..' part in my .bashrc, my auto completion is working for all the cases as before. (works for ls, vi, and others.. ). I'll get back to this when I have time later. Thanks! – Chan Kim Oct 9 '18 at 9:24
0

I guess your /etc/bash_completion.d/vi file got deleted . You should recreate it from e.g. the ls one.

See the GNU page on bash completion for more information, or this example.

  • Hi, thanks. I tried that but still not work correctly. I tried to add a comment here but it was so long, that I put an ADD in my original question. Hope you can give me a suggestion. Thanks! – Chan Kim Oct 8 '18 at 4:35

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.