Andrei A. Voropaev wrote:
Hello!

There is one thing about completion in version 7 that keeps confusing
me. Let's look at the example. Take the text

------------------------------
int test_func1()
{
}

int test_func2()
{
}
-----------------------------

Now I want to add new line

int test_func3()

I type 'int t' and the hit CTRL-P. The completion inserts test_func2 for
me. Now I hit BackSpace and continue typing '3('. But the completion does not
stop. It contitues untill I hit space. And if before hitting space I
want to complete another word, then it does not do it for me.

Is there any way to change this? So that when I hit BackSpace the
completion stops like it happens when I hit Space? Or even better, stop
the completion when I do any modification to the text at all?

Thank you.


Completion continues until:
- You type a non-word character, such as a space or a comma;
- You type a special key which is not used to continue completion;
- You add a letter for which no completion is found.

Adding or removing letters at the right makes Vim "recalculate" the set of possible completions. I find this very useful if there are too many matches. Let's take an example:

        Comment la mort du c<Ctrl-N>

hoping to find "connestable" (in old French spelling), the next word. However there are too many words starting with c or C and the match I need is not visible (it's off the first page of menu). gvim completes the first match in the menu, maybe C4_11 (an anchor tag name).

Ctrl-P to go back to what I typed (the menu stays up).
o (the 2nd letter of the match). Now I see only matches for co-. Depending on what I see, I can either type more incremental letters (-n-), or get the required word with the proper number of Ctrl-N.

To abort the menu, use anything which doesn't continue it, or the following two commands which specifically exit insert-completion mode:

<Ctrl-E> to *abort* the completion. The current match is not inserted.
<Ctrl-Y> to *accept* the completion. The current match is kept and the menu is closed.

These two have no other action than accept or reject the match and close the popup (see ":help complete_CTRL-E" and, just below it, ":help complete_CTRL-Y").

Many other things (including <Esc>) will *accept* the current completion and then do what they normally do in Insert mode.


Best regards,
Tony.
--
Life is a yo-yo, and mankind ties knots in the string.

Reply via email to