Monday, April 23, 2018

Re: Case-insensitive completefunc

On Mon, Apr 23, 2018 at 1:34 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On Mon, Apr 23, 2018 at 1:18 PM, David Woodfall <dave@dawoodfall.net> wrote:
>> Hi
>>
>> I've been reading the help to try to make the complete menu case
>> insensitive and I see the 'icase' setting, but for the life of me I
>> can't figure out how to use it.
>>
>> If I add it to the return value in my completefunc I just get errors.
>>
>> fun! UserComplete(findstart, base)
>> let line = getline(line('.'))
>> if line =~ '^\(To\|Cc\|Bcc\|From\|Reply-To\):'
>> return CompleteEmails(a:findstart, a:base)
>> endif
>> endfun
>>
>> I've tried making the return value a list by encasing in {} and
>> adding , 'icase': 1 (also '1').
>>
>> I've tried adding it to the end of the call to add an item to the
>> list:
>>
>> for m in split(system('completeemails ' . shellescape(a:base)), '\n')
>> call add(res, m)
>> endfor
>> add (res, 'icase': 1)
>> return res
>>
>> etc.
>>
>> Any help is hugely appreciated.
>
> • What is CompleteEmails() ?
> • Remember that a completefunc must return a Number when a:findstart
> is 1, a List or a Dictionary when a:findstart is 0.
> • Your system command executes a program named "completeemails" with
> no command-line parameters and a one-line stdin. Is that what you

Oops, my bad. It was a dot not a comma. With parameters and no stdin.
Anyway on my openSUSE Linux system there is no "completeemails" in the
$PATH. There is something named "complete" though. YMMV, though. Which
OS are you on?

> want? Then the output of that program is split at linefeed characters
> — you might just as well use systemlist()
>
> Best regards,
> Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: