When I am using the ctrl-n functionality (autocomplete word), it just inserts the text. I do not want to do that, instead, I would want to choose a word from the dropdown list, which I may then want to insert it later. Is there any way I can stop ctrl-n from inserting text while autocompleting? Are there any other autocomplete plugins that may have this workaround?


The word completition as you describe it's just how Ctrl-n works. I use the following mapping to make autocompletition:

inoremap <expr> <Tab> getline('.')[col('.') - 2] =~ '\w' ? "<C-N>" : "<Tab>"

which uses <Tab> to automatically complete the current word if there is only one match, otherwise it shows the dropdown list if the current word could match many others.

set completeopt+=noinsert

noinsert - do not insert any text for a match until the user selects a match from the menu. Only works in combination with "menu" or "menuone". No effect if "longest" is present.

For more info:

:h completeopt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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