Is strange but I got a work around to make my custom file detecction to work
properly.
As I posted in a previous email my plugin is not in my $HOME folder.
So I initialize the runtimepath to include my plugin path.
This is working cos  Iam sourcing several scripts for my plugin using the
runtime command.
After debugging and checking all the autocommands registerd in my vim
sesssion I noticed that for some reasson teh filetype.vim in my plugin
location is not sourced, or the autocommand is not registered.
I  also tried to createa a sl.vim script in my plugin ftdetect folder with
the next statement:
au BufNewFile,BufReadPost *.sl set filetype=sl
Is also not working so seems vim is not sourcing script in my ftdetect
folder.
Finally I wrtoe an script called tdvimFiletypes.vim with these lines:
if exists("did_load_tdvimfiletypes")
 finish
endif
let did_load_tdvimfiletypes= 1

augroup filetypedetect

 au BufNewFile,BufReadPost *.sl set filetype=sl

augroup END

in my vimrc I use the command:
runtime tdvimFiletype.vim
and is register the autocommand properly. IO have to change setf sl by set
filetype=sl to override the default file detection by vim which sets files
with the sl extension as slang instead of sl.
Probably is not the cleanest way to do it but works.
Any suggestion?
thx

2009/10/26 Charles Campbell <[email protected]>

>
> Pablo Giménez wrote:
> > Hi all.
> > I am writinga global plugin that, among other things, will override
> > some filetype settings.
> > So basically I have my plugin in the runtime and I want to know what
> > is the more ellegant/best wasy to:
> > - Override some tipe detection. for instance Iwant that files with
> > thesl extension will be threat as RenderMan shading language instead
> > of slang.
> > - Use my own settings for a file type, for example have my own
> > settings for python.
> >
> > I prefer to have a file for fiel type detection and one file per file
> > type settings.
> > I have tested creating my own filetype.vim in my plugin folder but not
> > yet working, however I am afraid to override complitelly the global
> > filetype.vim because Iwant to override it only for some file types,
> > and in case my file type is not detected then fallback to the global
> > filetype.vim.
> > Also if I have my own pytyhon.vim in the ftplugin folder of my plugin,
> > it will override the global one????
>
> 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
>
>
> >
>


-- 
Un saludo
Best Regards
Pablo Giménez

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

Reply via email to