Okay, this is really a hacky approach and I am not sure this is guaranteed to work all the time. However I managed to get something to work:
autocmd InsertCharPre * if v:char=~'[a-zA-Z_0-9]' | call feedkeys("\<c-n>", 'it')|endif
The reason I call it hacky and experimental is, that we are using
feedkeys() to inject a
Control-N character into the input queue whenever a character is entered that matches
[a-zA-Z0-9_] (adjust to taste).
However this might be unexpected for Vim and might cause all kind of problems later since the input queue buffer has been tempered with by us and that might be unexpected by Vim, so use with care!
And to make sure, the autocompletion won't overwrite what we have currently written, we need to set
:set completeopt+=noinsert,noselect (which basically means open the popup menu, but do not select anything yet and do not insert anything yet.
Also please note, this uses a stupid
<Ctrl-N> key, which means that the more clever completions (like e.g. path, omni- or user-defined completions) that are available (see
:h ins-completion) won't be used.