Add toggling capabilities for <c-o> in Insert and Prompt mode

Ref #2121
This commit is contained in:
Delapouite 2018-08-27 22:02:15 +02:00
parent 373858f9bf
commit c2bd4b38a0
2 changed files with 10 additions and 6 deletions

View File

@ -49,7 +49,7 @@ The `completers` option controls automatic completion, which kicks in when
the value specified in the `idle_timeout` option is reached. the value specified in the `idle_timeout` option is reached.
*<c-o>*:: *<c-o>*::
disable automatic completion for this insert session toggle automatic completion
*<c-n>*:: *<c-n>*::
select next completion candidate select next completion candidate
@ -734,7 +734,7 @@ The following keys are recognized by this mode to help with editing (See <<comma
insert next keystroke without interpreting it insert next keystroke without interpreting it
*<c-o>*:: *<c-o>*::
disable auto completion for this prompt toggle automatic completion
*<a-!>*:: *<a-!>*::
expand the typed expansions in currently entered text expand the typed expansions in currently entered text

View File

@ -887,10 +887,14 @@ public:
} }
else if (key == ctrl('o')) else if (key == ctrl('o'))
{ {
m_auto_complete = false; m_auto_complete = not m_auto_complete;
clear_completions(); if (m_auto_complete)
if (context().has_client()) refresh_completions(CompletionFlags::Fast);
else if (context().has_client())
{
clear_completions();
context().client().menu_hide(); context().client().menu_hide();
}
} }
else if (key == alt('!')) else if (key == alt('!'))
{ {
@ -1280,7 +1284,7 @@ public:
} }
else if (key == ctrl('o')) else if (key == ctrl('o'))
{ {
m_auto_complete = false; m_auto_complete = not m_auto_complete;
m_completer.reset(); m_completer.reset();
} }
else if (key == ctrl('u')) else if (key == ctrl('u'))