Bash – vi completes only directories in bash

autocompletebashvi

In a directory I type vi and then tab (twice), this gives me

user$ vi 
CMakeFiles/ global/     libs/

whereas ls followed by 2 tabs gives me

user$ ls 
! core.log CMakeFiles/ global/     libs/ _jni/

(Note: ls is aliased to `ls -Ah –color=auto', _jni is a symlink, and none of the files are hidden.)

I think vi is not showing any files, but only directories during tab-completion. Why is this happening? How to make vi behave same way as ls? I put following line in ~/.vimrc after going through one of the posts on SE. But it doesn't seem to do anything in this case.

set wildmode=longest,list,full
set wildmenu

Version of vi: VIM – Vi IMproved version 7.3.429
Version of ls: ls (GNU coreutils) 8.13

Best Answer

I had the same problem on Arch Linux, and finally I found that was the completion function's problem.

use complete -r vim to remove the completer. (or put that line to your bashrc)

Related Question