Alexey I. Froloff wrote:

> filetype.vim looks like:
> 
> augroup filetypedetect
> 
> ...
> 
> " Generic configuration file (check this last, it's just guessing!)
> au BufNewFile,BufRead,StdinReadPost *
>         \ ... some files are being setf'ed to "conf"
> 
> " Use the plugin-filetype checks last, they may overrule any of the previously
> " detected filetypes.
> runtime! ftdetect/*.vim
> 
> augroup END
> 
> 
> So, if Vim sets filetype to "conf", it is not possible to use
> :setf from ftdetect/*.vim, because of "but only if not done yet
> in a sequence of (nested) autocommands." setf feature.
> 
> Solution is simple - source ftdetect/*.vim before "conf"
> fallback.

The current method is correct.  In the ftdetect scripts you can check
for 'filetype' being equal to "conf" and then do ":set ft=anything" to
overrule it.  Use ":setf" only when you don't want to overrule the
default filetype.

The idea is that you can also do something like:

        if &ft == 'python' && SomeCheck()
          set ft=notpython
        elseif &ft == 'conf' && SomeOtherCheck()
          set ft=myconf
        endif

-- 
MAN:    Fetchez la vache!
GUARD:  Quoi?
MAN:    Fetchez la vache!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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    ///

Reply via email to