7
|
1 " Vim support file to switch on loading plugins for file types
|
|
2 "
|
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
|
856
|
4 " Last change: 2006 Apr 30
|
7
|
5
|
|
6 if exists("did_load_ftplugin")
|
|
7 finish
|
|
8 endif
|
|
9 let did_load_ftplugin = 1
|
|
10
|
|
11 augroup filetypeplugin
|
|
12 au FileType * call s:LoadFTPlugin()
|
856
|
13
|
7
|
14 func! s:LoadFTPlugin()
|
230
|
15 if exists("b:undo_ftplugin")
|
|
16 exe b:undo_ftplugin
|
|
17 unlet! b:undo_ftplugin b:did_ftplugin
|
|
18 endif
|
856
|
19
|
782
|
20 let s = expand("<amatch>")
|
|
21 if s != ""
|
7
|
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
|
782
|
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
|
7
|
33 endif
|
|
34 endfunc
|
|
35 augroup END
|