blob: 12f03648ca946f498a68cf5f399fc7d60ce52b5e [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim support file to switch on loading indent files for file types
2"
3" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar1015fde2008-02-25 19:46:51 +00004" Last Change: 2008 Feb 22
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
6if exists("did_indent_on")
7 finish
8endif
9let did_indent_on = 1
10
11augroup filetypeindent
Bram Moolenaar582fd852005-03-28 20:58:01 +000012 au FileType * call s:LoadIndent()
13 func! s:LoadIndent()
14 if exists("b:undo_indent")
15 exe b:undo_indent
16 unlet! b:undo_indent b:did_indent
17 endif
Bram Moolenaar1015fde2008-02-25 19:46:51 +000018 let s = expand("<amatch>")
19 if s != ""
Bram Moolenaar582fd852005-03-28 20:58:01 +000020 if exists("b:did_indent")
21 unlet b:did_indent
22 endif
Bram Moolenaar1015fde2008-02-25 19:46:51 +000023
24 " When there is a dot it is used to separate filetype names. Thus for
25 " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim".
26 for name in split(s, '\.')
27 exe 'runtime! indent/' . name . '.vim'
28 endfor
Bram Moolenaar582fd852005-03-28 20:58:01 +000029 endif
30 endfunc
Bram Moolenaar071d4272004-06-13 20:20:40 +000031augroup END