On 2009-11-26, Tony Mechelynck wrote:
> On 26/10/09 21:23, Charles Campbell wrote:

> > Don't modify the global filetype.vim -- next time you upgrade, your
> > modification(s) will be overwritten.
> >
> > Modify/create   $HOME/.vim/filetype.vim  .  An example of a typical entry:
> >
> > if exists("did_load_myfiletypes")
> >   finish
> > endif
> > let did_load_myfiletypes= 1
> >
> > augroup filetypedetect
> >
> >   au BufNewFile,BufReadPost *.dif,*.diff,ptch  setf diff
> > augroup END
> >
> >
> > Now, about $HOME/.vim/ftplugin/python.vim -- in the typical loading
> > sequence, it will be loaded before the global file(s)  (see  :echo&rtp
> > to get an idea of your loading sequence).  So it *won't* override the
> > global one.  If you want to override global plugins, may I suggest that
> > you put it in   $HOME/.vim/after/ftplugin/python.vim  instead.  It will
> > then be loaded after global plugins and will have a chance to override.
> >
> > Regards,
> > Chip Campbell
> 
> Oh, but it will override the global one, because the global filetype.vim 
> uses (just as in the above example) the ":setfiletype" command, which 
> will only set a filetype if it isn't already set.
> 
> In an after-plugin, you should use
> 
>       au BufRead,BufNewFile foobar setlocal filetype=whatever
> 
> instead.

I think you're confusing setting the filetype with setting
other option values for a particular filetype.  You could put
an "au BufRead,BufNewFile ..." command in your ~/.vimrc,
~/.vim/filetype or ~/.vim/ftdetect/<filetype>.vim file, but you
would not put one in a ~/.vim/ftplugin/<filetype>.vim or
~/.vim/after/ftplugin/<filetype>.vim file because because it
wouldn't be triggered until the _next_ BufRead or BufNewFile
event after the one that caused the filetype plugin to be
sourced.

Best regards,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to