> 2010/7/28 Bram Moolenaar <b...@moolenaar.net>:
> >
> > Dominique Pellé wrote:
> >
> >> > Please try and review the attached patch.
> >> > It think it does what's needed and it's rather simple:
> >> >
> >> > :setfiletype completes using things that match
> >> > $VIMRUNTIME/{syntax,ftplugin,indent}/*.vim and
> >> > ~/.vim/{syntax,ftplugin,indent}/*.vim
> >> >
> >> > :ownsyntax behaves as before, i.e. it completes using things that
> >> > match $VIMRUNTIME/syntax/*.vim and ~/.vim/syntax/*.vim
> >> >
> >> > You can verify that :ownsyntax and :setfiletype complete
> >> > differently with this example:
> >> >
> >> > :setfiletype host<CTRL-D>
> >> > hostconf     hostsaccess
> >> >
> >> > :ownsyntax host<CTRL-D>
> >> > hostconf
> >> >
> >> > I have not done anything about the special files such as
> >> > syntax/2html.vim. I could hard-code something to exclude
> >> > them but it'd be ugly. Hopefully we can consider moving
> >> > those special files.
> >>
> >>
> >> I send this patch again with slightly more elegant way of doing it
> >> saving 3 lines of code. Sorry for the noise.
> >
> > Thanks.
> >
> > I'll await the updated version that re-uses the function to remove
> > duplicates.
> >
> > Using fnamecmp() or STRCMP(): fnamecmp() should work the same or
> > slightly better.  E.g. if there is an indent/perl.vim and
> > syntax/Perl.vim it should end up only in "perl".  But only on systems
> > where case is ignored.  That's about correct, it matches the way Vim
> > will find and read the file from the filetype.  Another solution would
> > be to lower case the name always, as filetypes are supposed to be lower
> > case.
> 
> 
> Here is the updated patch taking into account Nazri's comments.
> Using fnamecmp() is fine indeed after rethinking about it.
> 
> remove_duplicates() now also loops backwards to avoid moving
> elements that would later be removed.
> 
> You can check that completion works with this example:
> 
> You can verify that :ownsyntax and :setfiletype complete
> differently with this example:
> 
>   :setfiletype host<CTRL-D>
>   hostconf     hostsaccess
> 
>   :ownsyntax host<CTRL-D>
>   hostconf
> 
> Still remains to be solved the problem of the few files such as
> syntax/2html.vim which are not syntax or ftplugin files.
> I'd prefer to move those special files somewhere else.  Is that OK?

Sounds good.

-- 
CART DRIVER: Bring out your dead!
   There are legs stick out of windows and doors.  Two MEN are fighting in the
   mud - covered from head to foot in it.  Another MAN is on his hands in
   knees shovelling mud into his mouth.  We just catch sight of a MAN falling
   into a well.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

Raspunde prin e-mail lui