completion functions (completefunc): Is it possible for completion items to contain newlines?

2007-04-08 Thread Thomas

Hi,

vim help says about completion functions for use with completefunc:


Each list item can either be a string or a Dictionary.  When it is a string it
is used as the completion.  When it is a Dictionary it can contain these
items:
wordthe text that will be inserted, mandatory
abbrabbreviation of word; when not empty it is used in
the menu instead of word


I'd like to have a completion that spans several lines, i.e. include 
newline characters. I tried several possibilities but neither one worked:


call add(t, {'word': a\nb, 'abbr': 'a'})
call add(t, {'word': 'a\nb', 'abbr': 'b'})
call add(t, {'word': a\crb, 'abbr': 'c'})
call add(t, {'word': a\c-jb, 'abbr': 'd'})

Is it possible? If yes, how?

If not, is it somehow possible to make a completion call a function 
instead of inserting the text? This probably is rather a feature 
request, but I was thinking of complementing a new field called 'agent' 
or 'function' that is supposed to do the actual work of inserting the 
text after an item was selected. An entry could then look like:


call add(t, {'function': 'InsertText(a\nb)', 'abbr': 'a'})

So I imagine the text stump would then be removed and the function 
called with the cursor at the position where the text should begin or so.


Regards,
Thomas.



Re: Silly Question

2007-04-08 Thread fREW

On 4/7/07, Matthew Winn [EMAIL PROTECTED] wrote:

On Fri, 06 Apr 2007 14:37:30 -0400, Mitch Wiedemann [EMAIL PROTECTED]
wrote:

 I'm unlucky enough to have 'i' as the second letter in both my first and
 last names...

 So I get a jump to the middle of the screen, or to the first word in the
 line, and then boring ol' text insertion...

I'm almost exactly the same, except that the end of my forename is
placed one character to the right of yours. If I stick to lower case
then it's a bit more interesting because the a becomes a mark, and
the rest of my name makes the cursor stagger along the line without
changing anything, ending up at the start of the word following the
word containing the next t.

Vowels are a problem. Unless you have an escape in your name, a, i
and o are boring letters. I know someone named Veerle and her name
is actually quite destructive, overwriting an entire line with l.
What's the most interesting name anyone can find, and also the most
damaging?

--
Matthew Winn




My realnames all do something boring:
Arthur (Append rthur)
Axel (Append xel)
Schmidt (Replace line with chmidt)

And my nickname is even sillier
fREW (find an R, move to the end of a WORD, then move to the end of
the next WORD.)

So yeah, boring.

-fREW