Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim autocomplete directory name

Tags:

vim

When I'm using filename autocompletion in command-line mode, how do I do select the current option to autocomplete?

For example, let's say I want to open the file ~/dev/myproject/foo.c

I start by typing:

:e ~/dtab

And I hit tab a couple of times until I see

:e ~/dev/

What do I press next to get vim to autocomplete the directories within ~/dev/?

If I hit enter, vim will open a buffer with the directory listing, which is not what I want.

I can hit / and then tab, but then I get an innocuous but aesthetically displeasing double-slash in my path:

:e ~/dev//tab

I can also hit "m", and then tab, which will work:

:e ~/dev/mtab

But what if I didn't remember that the next directory started with "m"?

How do I tell vim in the above example that "dev" is the autocomplete option that I want, and then to continue to do autocompletion for the next part of the path?

like image 680
Lorin Hochstein Avatar asked Oct 22 '25 05:10

Lorin Hochstein


1 Answers

:h wildmenu

<Down> - in filename/menu name completion: move into a subdirectory or submenu.

like image 95
Amadan Avatar answered Oct 24 '25 03:10

Amadan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!