Pretty frequently while I'm using vim, I'll run into something like this. I want to edit a specific .txt file, that is under ~/Documents/myProj, but I don't remember the name of the file. So I will do something like this:

:e ~/Documents/myProj/<tab><tab><tab><tab>...

until the file I recognize comes up. This is OK-ish, but it can sometimes be inconvenient when I have a lot of other files with different extensions, or even subdirectories in the same directory. Is there any way I could do something like:

:e ~/Documents/myProj/*.txt<tab><tab><tab><tab>...

and only have vim suggest the files that match the .txt extension?


What you describe is exactly how Vim behaves.

:e ~/Documents/myProj/*.txt<tab><tab><tab><tab>...

You may want to turn on 'wildmenu' in your vimrc so you can see the list or use <c-d>.

set wildmenu

For more help see:

:h 'wildmenu'
:h c_CTRL-D
:h cmdline-completion
  • Huh. Well now I feel really silly. That's what I get for asking a question before I try it out myself. And wildmenu is super useful too.
    – DJMcMayhem
    Oct 13 '16 at 17:26

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .