Daniel Kats
Daniel Kats

Reputation: 5554

vim wildmenu drill down into directories

I use vim to try to search for a file to open. I have wildmenu=full.

enter image description here

Pressing <tab> pushes me to the next directory, but how do I drill down on the currently-selected directory? My current workflow is: type a char, delete it, <tab> to continue. There must be a better way!

Upvotes: 9

Views: 1204

Answers (2)

Jorge Gajon
Jorge Gajon

Reputation: 1769

As @romainl said, read :help 'wildmenu', you can use <Down> to move to the currently selected directory.

There's another command I like to use in these situations (see :help c_CTRL-D). While typing a path for :e, hitting CTRL-D will list all the files and directories inside your currently selected directory. If you have started to type some letters then it will only show you those files that start with the same letters.

This way it is very easy to search for the file you are looking for, even if you are not sure of its name or subdirectory.

Hit CTRL-D, narrow your options by typing the first letter(s), hit CTRL-D again or use <Tab>, and if you have selected another subdirectory hit CTRL-D again to see the files contained inside.

Upvotes: 3

romainl
romainl

Reputation: 196546

Press <Down>.

The available keybindings are of course listed under :help 'wildmenu':

While the "wildmenu" is active the following keys have special
meanings:

<Left> <Right> - select previous/next match (like CTRL-P/CTRL-N)
<Down>         - in filename/menu name completion: move into a
                 subdirectory or submenu.
<CR>           - in menu completion, when the cursor is just after a
                 dot: move into a submenu.
<Up>           - in filename/menu name completion: move up into
                 parent directory or parent menu.

Upvotes: 7

Related Questions