1" Vim support file to switch on loading plugins for file types
2"
3" Maintainer:	Bram Moolenaar <Bram@vim.org>
4" Last change:	2006 Apr 30
5
6if exists("did_load_ftplugin")
7  finish
8endif
9let did_load_ftplugin = 1
10
11augroup filetypeplugin
12  au FileType * call s:LoadFTPlugin()
13
14  func! s:LoadFTPlugin()
15    if exists("b:undo_ftplugin")
16      exe b:undo_ftplugin
17      unlet! b:undo_ftplugin b:did_ftplugin
18    endif
19
20    let s = expand("<amatch>")
21    if s != ""
22      if &cpo =~# "S" && exists("b:did_ftplugin")
23	" In compatible mode options are reset to the global values, need to
24	" set the local values also when a plugin was already used.
25	unlet b:did_ftplugin
26      endif
27
28      " When there is a dot it is used to separate filetype names.  Thus for
29      " "aaa.bbb" load "aaa" and then "bbb".
30      for name in split(s, '\.')
31	exe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim'
32      endfor
33    endif
34  endfunc
35augroup END
36