Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new to ViM customization. I am almost done getting autocompletion to work as I would like. Here is the line of interest:

inoremap <expr> i (pumvisible() ? '' : 'i<C-n>') . '<Down>'

Notice that it captures i and then still types it (and then sends <C-n>). I would like for this to work like a regular expression. How can I get this to work with any word character? I'd rather not have several copies of this each for a different character.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There are no wildcards in mappings; you'd have to create all those mappings with a loop:

for i in split('abcdefg...', '\zs')
    execute printf("inoremap <expr> %s (pumvisible() ? '' : '%s<C-n>') . '<Down>'", i, i)

Please note that there are plugins that achieve auto-completion as you type (what you seem to attempt here); I use AutoComplPop - Automatically opens popup menu for completions

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.