Hi,

A.J.Mechelynck wrote:
> Jürgen Krämer wrote:
> [...]
>> the FileType event is only fired once with the exact filetype you
>> specified in your set command, so you must additionally define the
>> following autocommand:
>>
>>   autocmd FileType c.doxygen setlocal cindent number cursorline
> 
> If that is true, doesn't it defeat the purpose of setting the filetype with a 
> dot?

I'm not sure -- at least it seems to be a little bit inconsistent to
me, because ":help 'filetype'" explicitly mentions filetype plugins and
syntax files:

| When a dot appears in the value then this separates two filetype
| names.  Example:
|       /* vim: set filetype=c.doxygen : */ ~
| This will use the "c" filetype first, then the "doxygen" filetype.
| This works both for filetype plugins and for syntax files.  More than
| one dot may appear.

So, moving the ":setlocal" commands from the autocommand to a filetype
plugin would work, but there seem to be a lot of people that want to
keep their settings in one single place -- namely ~/.vimrc -- to make
it simpler to exchange them between multiple installations.

> Or should we add something like (untested)
> 
>    :au Filetype \(w*\).\(\S*\) exe "doau FileType \1" | exe "doau FileType \2"
> 
> ?

Nice idea (esp. the recursion), but alas it's not that simple, because
the pattern only accepts wildcards (not regular expressions) and if it
did, the subpatterns would probably not be recognized in the command.
But your command gave me an idea -- the following should work

  au FileType *.* exe substitute(expand('<amatch>'),
                  \              '^\(.*\)\.\(.*\)$',
                  \              'doau FileType \1 | doau FileType \2',
                  \              '')
> 
> ('cindent' is set by the indent/c.vim plugin).

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

Reply via email to