How to display a omni-comletion menu from a vim script function?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to display a omni-comletion menu from a vim script function?

Thomas-4-2
Hi,

I would like to use the new vim7 drop-down menu that is used with the
new omni-completion from a vim script in order to let the user select an
item from a list.

I figured I could temporarily set &omnifunc and use this to build the
list. But I wasn't able to find a way to trigger the display of the menu
from within a vim script.

Does somebody have an idea of how to display the menu?

Say, we have:

fun! MyComplete(findstart, base)
...
endf

fun! DoSomething()
     let omnifunc = &omnifunc
     let &omnifunc = 'MyComplete'
     try
         +++DISPLAY MENU+++
         return 0
     finally
         let &omnifunc = omnifunc
     endtry
endf

How would the "DISPLAY MENU" part look like?

Regards,
Thomas.

Reply | Threaded
Open this post in threaded view
|

Re: How to display a omni-comletion menu from a vim script function?

grayrest
On 3/15/07, Thomas <[hidden email]> wrote:
> Does somebody have an idea of how to display the menu?

I've been meaning to get around to doing this myself but haven't done
it. There's an example under :help complete-functions
Reply | Threaded
Open this post in threaded view
|

Re: How to display a omni-comletion menu from a vim script function?

Karl Guertin
In reply to this post by Thomas-4-2
On 3/15/07, Thomas <[hidden email]> wrote:
> Does somebody have an idea of how to display the menu?

I've been meaning to get around to doing this myself but haven't done
it. There's an example under :help complete-functions
Reply | Threaded
Open this post in threaded view
|

Re: How to display a omni-comletion menu from a vim script function?

Thomas-4-2
In reply to this post by Thomas-4-2
Let me rephrase my question:

Is it possible to display the omni-completion menu in normal mode, eg
from a function called in normal mode?

I don't want to set omnifunc or completefunc for this.

Regards,
Thomas.

Reply | Threaded
Open this post in threaded view
|

Re: How to display a omni-comletion menu from a vim script function?

Bram Moolenaar

Thomas wrote:

> Let me rephrase my question:
>
> Is it possible to display the omni-completion menu in normal mode, eg
> from a function called in normal mode?
>
> I don't want to set omnifunc or completefunc for this.

No, the omni-completion menu only works in Insert mode.

Using the popup menu in other modes is currently not supported.  There
is the GUI popup menu, like it's used for spell checking.

--
ARTHUR:  Then who is your lord?
WOMAN:   We don't have a lord.
ARTHUR:  What?
DENNIS:  I told you.  We're an anarcho-syndicalist commune.  We take it in
         turns to act as a sort of executive officer for the week.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///