How do I make Vim do normal (Bash-like) tab completion for file names? – Dev

The best answers to the question “How do I make Vim do normal (Bash-like) tab completion for file names?” in the category Dev.


When I’m opening a new file in Vim and I use tab completion, it completes the whole file name instead of doing the partial match like Bash does. Is there an option to make this file name tab completion work more like Bash?


The closest behavior to Bash’s completion should be

set wildmode=longest:full,full

With a few character typed, pressing tab once will give all the matches available in wildmenu. This is different to the answer by Michael which opens a quickfix-like window beneath the command-line.

Then you can keep typing the rest of the characters or press tab again to auto-complete with first match and circle around it.


I personally use

set wildmode=longest,list,full
set wildmenu

When you type the first tab hit, it will complete as much as possible. The second tab hit will provide a list. The third and subsequent tabs will cycle through completion options so you can complete the file without further keys.

Bash-like would be just

set wildmode=longest,list 

but the full is very handy.


If you don’t want to set the wildmenu, you can always press Ctrl + L when you want to open a file. Ctrl + L will complete the filename like Bash completion.


Apart from the suggested wildmode/wildmenu, Vim also offers the option to show all possible completions by using Ctrl + D. This might be helpful for some users that stumble across this question when searching for different autocompletion options in Vim like I did.