Give Yourself a Menu in Vim

Monday Sep 26th 2011 by Joe Brockmeier

Completing filenames when using Vim in command mode can be tricky. These tips will make it a simpler task.

This week, I have a quick couple of tips for Vim users that should make life just a little bit easier when using Vim in command mode and completing filenames.

By default, when you use Vim you can type the first letter or first few letters of a command, and you'll be able to cycle through the commands using Tab. For example, type :e, and you can cycle through all the commands that begin with e:


That's just a short list. But what if you'd like to see a quick menu of the available commands instead? For this, you have a little-known Vim option, wildmenu. As a reminder for folks not particularly well-versed with Vim, the : tells Vim to enter command mode from its normal mode.

While in Vim, just run :set wildmenu, and you'll toggle the option to enable the enhanced command-line completion. Note that you enable this any time by adding it to your ~/.vimrc.

So what does this little toggle get you? Now when you hit Tab, you'll get a one-line menu at the bottom so you can see all the options that begin with the letters you've typed. So :e will give you the same list as before, but in a one-line menu at the bottom. Hit Tab again, and it will move to the next command, and so forth. You can also use Ctrl-p and Ctrl-n to move backward and forward (respectively) through the list.

This doesn't work just with commands, though--it also works with filenames. If you're looking to open a file, for example, using :r (read) and you type the first character or characters, hitting Tab will display all the filenames that match in a one-line menu at the bottom.

Setting wildmenu is a minor thing, but it's another way to boost productivity and make Vim a bit more usable. I recommend giving this a shot. See if you don't find that it makes life a bit easier!

Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks,,, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at and follow him on Twitter.

Follow ServerWatch on Twitter

Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved