Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to discard the completion suggestion

Tags:

vim

I've just changed my 'completeopt' setting back from:

set completeopt = preview,menuone,longest

to the default:

set completeopt = preview,menuone

After a long while of using it as it was, I have decided that I prefer having the first entry selected by default.

I do have one annoyance though. I would like to be able to try to complete, if the match I'm looking for isn't in the list then discard the suggested completion and revert to my original text. How is this done?

I seem to remember from a distant past that this behaviour exists but randomly bashing buttons hasn't proved fruitful and searching isn't working out for me.

Thanks for any help.

like image 482
Greg Sexton Avatar asked Jun 12 '12 20:06

Greg Sexton


1 Answers

You can always type Ctrl-E to return to the original text.

Furthermore, Ctrl-N/Ctrl-P will eventually cycle back to the original text.

See: :help completion for more details:

When completion is active you can use CTRL-E to stop it and go back to the originally typed text. The CTRL-E will not be inserted.

like image 148
pb2q Avatar answered Oct 12 '22 09:10

pb2q