Bram Moolenaar <b...@moolenaar.net> wrote:

> Christian Brabandt wrote:
>
>> Hi Dominique!
>>
>> On Sa, 24 Jul 2010, Dominique Pellé wrote:
>>
>> > Hi
>> >
>> > Attached patch adds completion to the :setfiletype command.
>> > Example:
>> >
>> > :setf java<CTRL-D>
>> > java        javacc      javascript
>> >
>> > -- Dominique
>> >
>>
>> > diff -r 0c8219a26bc9 src/ex_docmd.c
>> > --- a/src/ex_docmd.c        Sat Jul 24 20:57:44 2010 +0200
>> > +++ b/src/ex_docmd.c        Sat Jul 24 23:36:07 2010 +0200
>> > @@ -3829,6 +3829,7 @@
>> >         xp->xp_pattern = arg;
>> >         break;
>> >
>> > +   case CMD_setfiletype:
>> >     case CMD_ownsyntax:
>> >         xp->xp_context = EXPAND_FILETYPE;
>> >         xp->xp_pattern = arg;
>>
>>
>> Since we now have filetype completion, why not add this to the
>> command-completion?
>>
>> chrisbra t41:~/vim/src [1157]% hg diff ex_docmd.c ../runtime/doc/map.txt
>> diff -r 5bd81e397907 runtime/doc/map.txt
>> --- a/runtime/doc/map.txt       Sun Jul 25 22:30:20 2010 +0200
>> +++ b/runtime/doc/map.txt       Mon Jul 26 13:22:25 2010 +0200
>> @@ -1215,6 +1215,7 @@
>>         -complete=mapping       mapping name
>>         -complete=menu          menus
>>         -complete=option        options
>> +       -complete=syntax        syntax
>>         -complete=tag           tags
>>         -complete=tag_listfiles tags, file names are shown when CTRL-D is hit
>>         -complete=var           user variables
>> diff -r 5bd81e397907 src/ex_docmd.c
>> --- a/src/ex_docmd.c    Sun Jul 25 22:30:20 2010 +0200
>> +++ b/src/ex_docmd.c    Mon Jul 26 13:22:25 2010 +0200
>> @@ -5280,6 +5280,7 @@
>>      {EXPAND_MENUS, "menu"},
>>      {EXPAND_SETTINGS, "option"},
>>      {EXPAND_SHELLCMD, "shellcmd"},
>> +    {EXPAND_FILETYPE, "syntax"},
>>  #if defined(FEAT_SIGNS)
>>      {EXPAND_SIGN, "sign"},
>>  #endif
>
> If this is completing filetypes, why call it "syntax"?  I would find
> "filetype" less confusing.
>
>> In the same way, we could also add compiler and colorscheme completion.
>> Is that useful?
>
> Generally completion is useful.  Note that I'm not going to include new
> features now. But these tiny changes should be OK.


I remember being a bit confused too with this when I wrote the patch.
The completion EXPAND_FILETYPE expands things from files
located in $VIMRUNTIME/syntax/.

EXPAND_SYNTAX already existed but it's something completely
different: it the expansion of the ":syntax"  command.

Maybe $VIMRUNTIME/syntax/ should have rather be called
$VIMRUNTIME/filetype/ but this should not be changed anymore
since it has been like this for a long time and changing name would
break things.

-- Dominique

-- 
You received this message from the "vim_dev" 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

Reply via email to