Reputation: 35627
I am learning vim with omnicomplete. I am wondering whether I can show the omnicomplete list without autocompleting current text. For example,
If I type "str.c" and then invoke omnicomplete, it will show a list containing possible words starting with "c", and autocomplete the current text to, say "capitalize".
If, for example, the method I am looking for is count, I have to scroll all the way down the list to find it, or delete the "apitalize" part, and then type o, etc. Is it possible to just show the list, so that if I invoke it after c, it will show the list without autocompleting to capitalize? For example to something like below, where I can still type o to quickly go to count
Upvotes: 4
Views: 9984
Reputation: 359
I think that the initial problem was the lack of noinsert
in completeopt
option.
Upvotes: 1
Reputation: 8398
Alternatively, you can press <C-P>
right after <C-X><C-O>
to go back to what you typed while keeping the completion menu open.
Check out :h ins-completion-menu
for more information.
Upvotes: 1
Reputation: 17497
You can also just stick with the basic vim functionality, and use C-e
while in completion to have vim remove the list and go back to the point you initiated the completion.
Upvotes: 1
Reputation: 35627
Thanks to @romainl comment, I looked up completeopt, and I found the answer Make Vim completion popup menu work just like in an IDE. It has a bunch of other related tips. To make the behaviour as described in the question,
:set completeopt=longest,menuone
Upvotes: 15