claws fix
[~madcoder/dotfiles.git] / vim / filetype.vim
1 if exists("did_load_filetypes")
2   finish
3 endif
4
5 augroup filetypedetect
6   au BufRead,BufNewFile *.JS               setf javascript
7   au BufRead,BufNewFile *.jas              setf asm
8   au BufRead,BufNewFile *.swfml            setf xml
9   au BufRead,BufNewFile *.hx               setf haxe
10
11   au BufRead,BufNewFile *.tpl              setf xhtml
12   au BufRead,BufNewFile *.blk              setf c
13
14   au BufRead,BufNewFile massif.*.txt       setf massif
15
16   " HTML (.shtml and .stm for server side)
17   au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm  call s:FThtml()
18
19   au BufNewFile,BufRead {mad,}mutt{ng,}-*-\w\+ setf mail
20
21   au BufNewFile,BufRead */X11/xkb/* setf xkb
22
23   au BufNewFile,BufRead *.as setf actionscript
24
25   au BufNewFile,BufRead *.dox setf doxygen
26
27   au BufNewFile,BufRead *.iop setf d
28
29   au BufNewFile,BufRead .gitsendemail.* setf gitsendemail
30
31   " Distinguish between HTML, XHTML and Django
32   fun! s:FThtml()
33     let n = 1
34     while n < 10 && n < line("$")
35       if getline(n) =~ '<?'
36         setf php
37         return
38       endif
39       if getline(n) =~ '\<DTD\s\+XHTML\s'
40         setf xhtml
41         return
42       endif
43       if getline(n) =~ '{%\s*\(extends\|block\)\>'
44         setf htmldjango
45         return
46       endif
47       let n = n + 1
48     endwhile
49     setf html
50   endfun
51
52 augroup END