I'm a bit confused about the use of Vim's menus. I have set wildmenu
and set wildmode=list:longest,full
but I don't understand for the life of me how to invoke and use the completion feature.
Is this feature useful? Why and how? What kind of completion does this do exactly? In other words, what determines the completion list content?
Any tips and example usages would be appreciated.
:set wildmode=list:longest allows you to expand the wildmenu. :set wildmenu allows you to use <Left> or <Right> to navigate through the completion lists. Is there a way so that if you hit tab, you could scroll through the completion lists? just :set wildmenu=list:full instead.
"set wildmenu" enables a menu at the bottom of the vim/gvim window. The meaning of "list:longest,full" is so that when you do completion in the command line via tab, these events will happen: 1. (on the first tab) a list of completions will be shown and the command will be completed to the longest common command. 2.
wildmenu
and wildmode
are used for command line completion. The simplest way to try it would be with :color <Tab>
: the command line is "expanded" vertically with a list of all the colorschemes available on your machine displayed in columns and an horizontal strip that you can navigate with <Tab>
(forward) and <S-Tab>
(backward).
The behaviour of command line completion and wildmenu
are dependant on wildmode
.
See :help wildmode
and :help wildmenu
for more details.
Probably the most comfortable option, at least for me is:
set wildmenu set wildmode=longest:full,full
That means that on first <Tab>
it will complete to the longest common string and will invoke wildmenu (a horizontal and unobtrusive little menu). On next <Tab>
it will complete the first alternative and it will start to cycle through the rest. You can go back and forth with <Tab>
and <S-Tab>
respectively.
An awesome example on how wildmenu is very useful, is to complete buffers, use the config I posted and then try:
:b<Tab>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With