Friday, January 28, 2011

Re: Update completions list

On 1/20/2011 5:47 AM, gearheart wrote:
Hi  I'm working on custom autocomplete function and I cannot figure out how to force vim update completions list on each new character entered.  Could you please explain how to trick vim to update completions list? Or maybe you can give links to documentation where I can read about this?  
Did you make any headway on this yet?

I would start with :h ins-completion

I would also start by copying one of the existing completion scripts.

Basically, you have to write a function like this:
    function! sqlcomplete#Complete(findstart, base)

The difficult part of this is the above function is always called twice in a row by Vim.
The first time allows you to figure out what you want to complete, the second call builds the list of completions.

So as you mention:
how to force vim update completions list on each new character entered. 

That is done by your own code as it is the first called to the Complete function and allows you to add to the "base" of the completion.

Remember, this command will save your life as your write one of these:
:breakadd func *Complete*

Then just step through it using the debugger keys "n"ext and "s"tep.

HTH,
Dave

No comments:

Post a Comment