Dominique Pelle wrote:

> Peter Odding wrote:
> 
> > Ingo Karkat wrote:
> >>
> >> Granted, most filetypes do define custom highlighting via a
> >> $VIMRUNTIME/syntax/<filetype>.vim script. But shouldn't the filetype
> >> completion
> >> also take into account files from the ftplugin and syntax directories,
> >> too?
> >> If I for example have a custom filetype "bullettext" that defines custom
> >> fold
> >> and indent settings, but no highlighting, I would expect to have this
> >> filetype
> >> included in the completion.
> >
> > Like Ingo I have several custom file types under my ~/.vim/ directory that
> > don't have an associated syntax script and visa versa.
> >
> > Bram Molenaar wrote:
> >>
> >> Aha, so the filetypes are found by looking in the syntax directory.
> >> Well, the result is still a list of filetypes, although there can be a
> >> few syntax files that are not a filetype (e.g. 2html.vim).  So do we let
> >> the implementation details prevail?  Or stick to the intention?
> >
> > If sticking to the intention doesn't involve too much code that would IMHO
> > be preferable to the current implementation because of the reason given
> > above.
> >
> > Ideally file type completion would consider the base filenames of the Vim
> > scripts in the system wide / user specific ftplugin / syntax / indent
> > directories (and also their /after/ variants) but this might be too complex?
> 
> I can try to change the behavior.   But just to make sure I understand
> the problems:
> 
> :setfiletype and :ownsyntax commands currently both perform
> completion by looking at syntax/*.vim from both $VIMRUNTIME
> and ~/.vim/.
> 
> That's almost fine, but it not ideal for 2 reasons:
> 
> 1/ :setfiletype should actually complete by looking at files matching
>   {syntax,ftplugin,indent}/*.vim from both $VIMRUNTIME/ and ~/.vim/
>   :ownsyntax completion should only look at syntax/*.vim (as it does now).
> 
> 2/ there are a few files matching syntax/*.vim which are not syntax
>    files such as 2html.vim, syntax.vim, colortest.vim... They can thus
>    show up as a spurious completion results.  These special files are
>    listed in syntax/README.txt. Any reasons for them to be in the
>    syntax/ directory?

Historic reasons.  I think it's not much of a problem, one would simply
not select these as the desired filetype.  Moving them elsewhere will
break scripts.

> In practice, current implementation is almost fine since almost
> all files matching $VIMRUNTIME/{ftplugin,indent}/*.vim have a
> corresponding file matching $VIMRUNTIME/syntax/*.vim.  Using
> the following commands...
> 
> $ cd /usr/local/share/vim/vim73c
> $ vim -d <(cd syntax/; ls *.vim) <(cd ftplugin/; ls *.vim)
> $ vim -d <(cd syntax/; ls *.vim) <(cd indent/; ls *.vim)
> 
> ... I see only 3 files matching ftplugin/*.vim which do not correspond
> to any file syntax/*.vim
> 
> - ftplugin/hostaccess.vim
> - ftplugin/quickfix.vim
> - ftplugin/AppendMatchGroup.vim:   this file does not look
>   like a file type plugin anyway. It appears to contain a helper
>   function. Should it really be there?

That should be an autoload script.  I don't think that was possible when
it was written.  I'll ping the author, but it's been a long time.

> And 1 file matching index/*.vim which has no corresponding files
> matching syntax/*.vim:
> 
> - indent/GenericIndent.vim: this file is not an indent file but
>   contains helper functions. Should it be stored somewhere else?

It's from the same author.

> I don't think this is a blocker for the release but Bram can decide :-)

I think that users will be disappointed when the filetype they were
looking for does not show up in completion.  It's not so bad if a few
more choices pop up, a user can simply skip over them.

We need to keep performance in mind, completion is being done
interactive.  But the syntax directory is the biggest one, adding indent
and ftplugin can't make it more than twice as slow.  Hopefully.

Following these arguments we should add the indent and ftplugin
directories.  And make sure duplicates are removed.

-- 
The most powerful force in the universe is gossip.

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