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


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

Reply via email to