Sunday, July 31, 2011

Custom Completion Function

Hi,

I'm learning to write a vim plugin. One thing I'm trying to do is to use the custom completion function (^X^U). The problem is I need a list of completion items and a short description. So I tried to use each item as a dict ('word' : <word> and 'menu' : <description>). This works fine, except that I need to find out what was the completion chosen by user. How to find that? There are duplicates in the completion items and only way to find correct entry is by knowing description as well. Eg:

abcd <a@c.com>
dup   <d1@c.com>
dup   <d2@c.com>
xyz   <x@y.com

Is there a callback or something that can be registered to find out which item user chose?

Another minor thing is doing ^X^U will complete to the first item. Is there a way not to do that? I want something like completion on browsers. While user types it should show the options. Currently I have to do ^X^U then backspace till beginning and start typing.

Thanks,
Amit

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment