Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to autocomplete options in vim command mode

Tags:

vim

vim-plugin

my setting for command mode completion is:

set wildmenu
set wildmode=longest,list,full

currently when i type

:set fdm=

in command mode, then press tab, manual appended, if i Press tab again , character ^I appended, what i want is manual changed to another foldmethod options such as syntax, indent and so on.

does anyone know is that possible or if there is any plugin could do that ?

thanks !

like image 897
dfang Avatar asked Aug 21 '13 08:08

dfang


1 Answers

As you say, when you press <Tab> after :set fdm=, you get manualinserted.

That could seem the usual autocomplete behaviour we are used to in many places, manual being just the first of all possible values. So, you expect that repeating <Tab> will give you more possibilites.

But that's not indeed the case. What you get when pressing <Tab> in such a situation is not the first autocompletion alternative, but the current option value. So, you're getting manual because that's in fact the default value for that option. Successive <Tab>s get inserted literally, as this behaviour is only fired right after =.

From Vim's help:

The old value of an option can be obtained by hitting 'wildchar' just after
the '='.  For example, typing 'wildchar' after ":set dir=" will insert the
current value of 'dir'.  This overrules file name completion for the options
that take a file name.

So, what you described is expected behaviour. See :help cmdline-completion for the whole story.

I don't know about any plugin capable of changing this to what you want.

like image 54
elmart Avatar answered Oct 31 '22 16:10

elmart