I would like to have autocompletion active on its own like on sublime text without doing Ctrl+n.

I would like to have this without any none native plugins as the already existing autocompletion in vim fits my needs.

I guess this can be done through .vimrc but I have no idea how to do it.

  • Have you read this question? It is the second google result for "vim native autocompletion" and it sounds like a duplicate to me.
    – statox
    Commented Mar 29, 2018 at 12:10
  • No this doesn't answer my question, I would like the autocomplete "choices" to appear on there own like on sublime text or most ide or text editor.
    – user16659
    Commented Mar 29, 2018 at 12:18
  • Are you using any plugins? Or do you want to use native completions? Maybe checkout deoplete?
    – 3N4N
    Commented Mar 29, 2018 at 12:55

1 Answer 1


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:

augroup MyCompletion
  autocmd InsertCharPre * if v:char=~'[a-zA-Z_0-9]' | call feedkeys("\<c-n>", 'it')|endif
augroup end

set completeopt+=noinsert,noselect

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.