On 28-Jul-2010 00:03, Dominique Pellé wrote:
> 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.
> 
> -- Dominique

Sorry, I haven't tried your patch yet, only reviewed it. I'd like to point out
the naming peculiarities for ftplugins (:help ftplugin-name), which I think
require additional filtering of the retrieved *.vim names:

| The generic names for the filetype plugins are:
|
|       ftplugin/<filetype>.vim
|       ftplugin/<filetype>_<name>.vim
|       ftplugin/<filetype>/<name>.vim

Therefore, ftplugin (this doesn't seem to apply to syntax and indent scripts)
file names containing an underscore should be filtered from the list of
filenames, to avoid that those <filetype>_<name> names appear in the completion
list. For example, I use vim_ingoabb.vim to define my own abbreviations for the
Vim filetype.
I think it is okay to filter out the <filetype>_<name>.vim and ignore the
<filetype>/<name>.vim files, though it would be more correct to consider them,
too. Those alternative ways are meant for additions to the main <filetype>.vim
file, so only considering the main file should yield all installed filetypes,
anyway.

I'm sorry if this makes the implementation more complex, but I think these
spurious filetypes shouldn't be included.


> +     return ExpandRTDir(pat, num_file, file, "{syntax,indent,ftplugin}");

Have you tested this on Windows? If I execute
    :echo globpath(&rtp, '{syntax,indent,ftplugin}/*.vim')
nothing is returned on Windows. ":help wildcards" mentions:
|   Which wildcards are supported depends on the system.
Seems like the {a,b,c} is a Bash-ism that isn't available on Windows.

Please excuse me if nothing here actually applies to your patch; as I said, I
haven't been able to actually test it yet, but wanted to get this feedback out
to you while you're still fiddling with it.

-- regards, ingo

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