Merge branch 'vim-with-runtime' into feat/quickfix-title
[vim_extended.git] / runtime / ftplugin.vim
bloba434b9372b048ba929ac16afd00abf1a676fd24b
1 " Vim support file to switch on loading plugins for file types
3 " Maintainer:   Bram Moolenaar <Bram@vim.org>
4 " Last change:  2006 Apr 30
6 if exists("did_load_ftplugin")
7   finish
8 endif
9 let did_load_ftplugin = 1
11 augroup filetypeplugin
12   au FileType * call s:LoadFTPlugin()
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
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
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
35 augroup END