PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/vim7.0.243/runtime/filetype.vim

#
Vim Script | 2180 lines | 2102 code | 36 blank | 42 comment | 23 complexity | ba7c72a3d4f53fe6437c4f08906319d8 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. " Vim support file to detect file types
  2. "
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last Change: 2006 May 02
  5. " Listen very carefully, I will say this only once
  6. if exists("did_load_filetypes")
  7. finish
  8. endif
  9. let did_load_filetypes = 1
  10. " Line continuation is used here, remove 'C' from 'cpoptions'
  11. let s:cpo_save = &cpo
  12. set cpo&vim
  13. augroup filetypedetect
  14. " Ignored extensions
  15. au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.rpmsave,?\+.rpmnew
  16. \ exe "doau filetypedetect BufRead " . expand("<afile>:r")
  17. au BufNewFile,BufRead *~
  18. \ let s:name = expand("<afile>") |
  19. \ let s:short = substitute(s:name, '\~$', '', '') |
  20. \ if s:name != s:short && s:short != "" |
  21. \ exe "doau filetypedetect BufRead " . s:short |
  22. \ endif |
  23. \ unlet s:name |
  24. \ unlet s:short
  25. au BufNewFile,BufRead ?\+.in
  26. \ if expand("<afile>:t") != "configure.in" |
  27. \ exe "doau filetypedetect BufRead " . expand("<afile>:r") |
  28. \ endif
  29. " Pattern used to match file names which should not be inspected.
  30. " Currently finds compressed files.
  31. if !exists("g:ft_ignore_pat")
  32. let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
  33. endif
  34. " Function used for patterns that end in a star: don't set the filetype if the
  35. " file name matches ft_ignore_pat.
  36. fun! s:StarSetf(ft)
  37. if expand("<amatch>") !~ g:ft_ignore_pat
  38. exe 'setf ' . a:ft
  39. endif
  40. endfun
  41. " Abaqus or Trasys
  42. au BufNewFile,BufRead *.inp call s:Check_inp()
  43. fun! s:Check_inp()
  44. if getline(1) =~ '^\*'
  45. setf abaqus
  46. else
  47. let n = 1
  48. if line("$") > 500
  49. let nmax = 500
  50. else
  51. let nmax = line("$")
  52. endif
  53. while n <= nmax
  54. if getline(n) =~? "^header surface data"
  55. setf trasys
  56. break
  57. endif
  58. let n = n + 1
  59. endwhile
  60. endif
  61. endfun
  62. " A-A-P recipe
  63. au BufNewFile,BufRead *.aap setf aap
  64. " A2ps printing utility
  65. au BufNewFile,BufRead etc/a2ps.cfg,etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps
  66. " ABAB/4
  67. au BufNewFile,BufRead *.abap setf abap
  68. " ABC music notation
  69. au BufNewFile,BufRead *.abc setf abc
  70. " ABEL
  71. au BufNewFile,BufRead *.abl setf abel
  72. " AceDB
  73. au BufNewFile,BufRead *.wrm setf acedb
  74. " Ada (83, 9X, 95)
  75. au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada
  76. " AHDL
  77. au BufNewFile,BufRead *.tdf setf ahdl
  78. " AMPL
  79. au BufNewFile,BufRead *.run setf ampl
  80. " Ant
  81. au BufNewFile,BufRead build.xml setf ant
  82. " Apache style config file
  83. au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle')
  84. " Apache config file
  85. au BufNewFile,BufRead .htaccess setf apache
  86. au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf* call s:StarSetf('apache')
  87. " XA65 MOS6510 cross assembler
  88. au BufNewFile,BufRead *.a65 setf a65
  89. " Applix ELF
  90. au BufNewFile,BufRead *.am
  91. \ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif
  92. " ALSA configuration
  93. au BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.conf setf alsaconf
  94. " Arc Macro Language
  95. au BufNewFile,BufRead *.aml setf aml
  96. " Arch Inventory file
  97. au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch
  98. " ART*Enterprise (formerly ART-IM)
  99. au BufNewFile,BufRead *.art setf art
  100. " ASN.1
  101. au BufNewFile,BufRead *.asn,*.asn1 setf asn
  102. " Active Server Pages (with Visual Basic Script)
  103. au BufNewFile,BufRead *.asa
  104. \ if exists("g:filetype_asa") |
  105. \ exe "setf " . g:filetype_asa |
  106. \ else |
  107. \ setf aspvbs |
  108. \ endif
  109. " Active Server Pages (with Perl or Visual Basic Script)
  110. au BufNewFile,BufRead *.asp
  111. \ if exists("g:filetype_asp") |
  112. \ exe "setf " . g:filetype_asp |
  113. \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |
  114. \ setf aspperl |
  115. \ else |
  116. \ setf aspvbs |
  117. \ endif
  118. " Grub (must be before catch *.lst)
  119. au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf,/etc/grub.conf setf grub
  120. " Assembly (all kinds)
  121. " *.lst is not pure assembly, it has two extra columns (address, byte codes)
  122. au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm()
  123. " This function checks for the kind of assembly that is wanted by the user, or
  124. " can be detected from the first five lines of the file.
  125. fun! s:FTasm()
  126. " make sure b:asmsyntax exists
  127. if !exists("b:asmsyntax")
  128. let b:asmsyntax = ""
  129. endif
  130. if b:asmsyntax == ""
  131. call s:FTasmsyntax()
  132. endif
  133. " if b:asmsyntax still isn't set, default to asmsyntax or GNU
  134. if b:asmsyntax == ""
  135. if exists("g:asmsyntax")
  136. let b:asmsyntax = g:asmsyntax
  137. else
  138. let b:asmsyntax = "asm"
  139. endif
  140. endif
  141. exe "setf " . b:asmsyntax
  142. endfun
  143. fun! s:FTasmsyntax()
  144. " see if file contains any asmsyntax=foo overrides. If so, change
  145. " b:asmsyntax appropriately
  146. let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
  147. \" ".getline(5)." "
  148. if head =~ '\sasmsyntax=\S\+\s'
  149. let b:asmsyntax = substitute(head, '.*\sasmsyntax=\(\S\+\)\s.*','\1', "")
  150. elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
  151. let b:asmsyntax = "vmasm"
  152. endif
  153. endfun
  154. " Macro (VAX)
  155. au BufNewFile,BufRead *.mar setf vmasm
  156. " Atlas
  157. au BufNewFile,BufRead *.atl,*.as setf atlas
  158. " Automake
  159. au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake
  160. " Autotest .at files are actually m4
  161. au BufNewFile,BufRead *.at setf m4
  162. " Avenue
  163. au BufNewFile,BufRead *.ave setf ave
  164. " Awk
  165. au BufNewFile,BufRead *.awk setf awk
  166. " B
  167. au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
  168. " BASIC or Visual Basic
  169. au BufNewFile,BufRead *.bas call s:FTVB("basic")
  170. " Check if one of the first five lines contains "VB_Name". In that case it is
  171. " probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
  172. fun! s:FTVB(alt)
  173. if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
  174. setf vb
  175. else
  176. exe "setf " . a:alt
  177. endif
  178. endfun
  179. " Visual Basic Script (close to Visual Basic)
  180. au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb
  181. " Batch file for MSDOS.
  182. au BufNewFile,BufRead *.bat,*.sys setf dosbatch
  183. " *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
  184. au BufNewFile,BufRead *.cmd
  185. \ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
  186. " Batch file for 4DOS
  187. au BufNewFile,BufRead *.btm call s:FTbtm()
  188. fun! s:FTbtm()
  189. if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
  190. setf dosbatch
  191. else
  192. setf btm
  193. endif
  194. endfun
  195. " BC calculator
  196. au BufNewFile,BufRead *.bc setf bc
  197. " BDF font
  198. au BufNewFile,BufRead *.bdf setf bdf
  199. " BibTeX bibliography database file
  200. au BufNewFile,BufRead *.bib setf bib
  201. " BibTeX Bibliography Style
  202. au BufNewFile,BufRead *.bst setf bst
  203. " BIND configuration
  204. au BufNewFile,BufRead named.conf,rndc.conf setf named
  205. " BIND zone
  206. au BufNewFile,BufRead named.root setf bindzone
  207. au BufNewFile,BufRead *.db call s:BindzoneCheck('')
  208. func! s:BindzoneCheck(default)
  209. if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA'
  210. setf bindzone
  211. elseif a:default != ''
  212. exe 'setf ' . a:default
  213. endif
  214. endfunc
  215. " Blank
  216. au BufNewFile,BufRead *.bl setf blank
  217. " C or lpc
  218. au BufNewFile,BufRead *.c call s:FTlpc()
  219. fun! s:FTlpc()
  220. if exists("g:lpc_syntax_for_c")
  221. let lnum = 1
  222. while lnum <= 12
  223. if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
  224. setf lpc
  225. return
  226. endif
  227. let lnum = lnum + 1
  228. endwhile
  229. endif
  230. setf c
  231. endfun
  232. " Calendar
  233. au BufNewFile,BufRead calendar setf calendar
  234. au BufNewFile,BufRead */.calendar/*,
  235. \*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
  236. \ call s:StarSetf('calendar')
  237. " C#
  238. au BufNewFile,BufRead *.cs setf cs
  239. " Cfengine
  240. au BufNewFile,BufRead cfengine.conf setf cfengine
  241. " Comshare Dimension Definition Language
  242. au BufNewFile,BufRead *.cdl setf cdl
  243. " Controllable Regex Mutilator
  244. au BufNewFile,BufRead *.crm setf crm
  245. " Cyn++
  246. au BufNewFile,BufRead *.cyn setf cynpp
  247. " Cynlib
  248. " .cc and .cpp files can be C++ or Cynlib.
  249. au BufNewFile,BufRead *.cc
  250. \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif
  251. au BufNewFile,BufRead *.cpp
  252. \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif
  253. " C++
  254. if has("fname_case")
  255. au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
  256. else
  257. au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
  258. endif
  259. " .h files can be C, Ch or C++, set c_syntax_for_h if you want C,
  260. " ch_syntax_for_h if you want Ch.
  261. au BufNewFile,BufRead *.h
  262. \ if exists("c_syntax_for_h") | setf c |
  263. \ elseif exists("ch_syntax_for_h") | setf ch |
  264. \ else | setf cpp | endif
  265. " Ch (CHscript)
  266. au BufNewFile,BufRead *.chf setf ch
  267. " TLH files are C++ headers generated by Visual C++'s #import from typelibs
  268. au BufNewFile,BufRead *.tlh setf cpp
  269. " Cascading Style Sheets
  270. au BufNewFile,BufRead *.css setf css
  271. " Century Term Command Scripts (*.cmd too)
  272. au BufNewFile,BufRead *.con setf cterm
  273. " Changelog
  274. au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch
  275. \ setf debchangelog
  276. au BufNewFile,BufRead [cC]hange[lL]og
  277. \ if getline(1) =~ '; urgency='
  278. \| setf debchangelog
  279. \| else
  280. \| setf changelog
  281. \| endif
  282. au BufNewFile,BufRead NEWS
  283. \ if getline(1) =~ '; urgency='
  284. \| setf debchangelog
  285. \| endif
  286. " CHILL
  287. au BufNewFile,BufRead *..ch setf chill
  288. " Changes for WEB and CWEB or CHILL
  289. au BufNewFile,BufRead *.ch call s:FTchange()
  290. " This function checks if one of the first ten lines start with a '@'. In
  291. " that case it is probably a change file.
  292. " If the first line starts with # or ! it's probably a ch file.
  293. " If a line has "main", "include", "//" ir "/*" it's probably ch.
  294. " Otherwise CHILL is assumed.
  295. fun! s:FTchange()
  296. let lnum = 1
  297. while lnum <= 10
  298. if getline(lnum)[0] == '@'
  299. setf change
  300. return
  301. endif
  302. if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
  303. setf ch
  304. return
  305. endif
  306. if getline(lnum) =~ "MODULE"
  307. setf chill
  308. return
  309. endif
  310. if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
  311. setf ch
  312. return
  313. endif
  314. let lnum = lnum + 1
  315. endwhile
  316. setf chill
  317. endfun
  318. " ChordPro
  319. au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro
  320. " Clean
  321. au BufNewFile,BufRead *.dcl,*.icl setf clean
  322. " Clever
  323. au BufNewFile,BufRead *.eni setf cl
  324. " Clever or dtd
  325. au BufNewFile,BufRead *.ent call s:FTent()
  326. fun! s:FTent()
  327. " This function checks for valid cl syntax in the first five lines.
  328. " Look for either an opening comment, '#', or a block start, '{".
  329. " If not found, assume SGML.
  330. let lnum = 1
  331. while lnum < 6
  332. let line = getline(lnum)
  333. if line =~ '^\s*[#{]'
  334. setf cl
  335. return
  336. elseif line !~ '^\s*$'
  337. " Not a blank line, not a comment, and not a block start,
  338. " so doesn't look like valid cl code.
  339. break
  340. endif
  341. let lnum = lnum + 1
  342. endw
  343. setf dtd
  344. endfun
  345. " Clipper (or FoxPro; could also be eviews)
  346. au BufNewFile,BufRead *.prg
  347. \ if exists("g:filetype_prg") |
  348. \ exe "setf " . g:filetype_prg |
  349. \ else |
  350. \ setf clipper |
  351. \ endif
  352. " Cmake
  353. au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake
  354. " Cobol
  355. au BufNewFile,BufRead *.cbl,*.cob,*.lib setf cobol
  356. " cobol or zope form controller python script? (heuristic)
  357. au BufNewFile,BufRead *.cpy
  358. \ if getline(1) =~ '^##' |
  359. \ setf python |
  360. \ else |
  361. \ setf cobol |
  362. \ endif
  363. " Cold Fusion
  364. au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
  365. " Configure scripts
  366. au BufNewFile,BufRead configure.in,configure.ac setf config
  367. " WildPackets EtherPeek Decoder
  368. au BufNewFile,BufRead *.dcd setf dcd
  369. " Enlightenment configuration files
  370. au BufNewFile,BufRead *enlightenment/*.cfg setf c
  371. " Eterm
  372. au BufNewFile,BufRead *Eterm/*.cfg setf eterm
  373. " Lynx config files
  374. au BufNewFile,BufRead lynx.cfg setf lynx
  375. " Quake
  376. au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake
  377. au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
  378. " Quake C
  379. au BufNewFile,BufRead *.qc setf c
  380. " Configure files
  381. au BufNewFile,BufRead *.cfg setf cfg
  382. " Communicating Sequential Processes
  383. au BufNewFile,BufRead *.csp,*.fdr setf csp
  384. " CUPL logic description and simulation
  385. au BufNewFile,BufRead *.pld setf cupl
  386. au BufNewFile,BufRead *.si setf cuplsim
  387. " Debian Control
  388. au BufNewFile,BufRead */debian/control setf debcontrol
  389. " Debian Sources.list
  390. au BufNewFile,BufRead /etc/apt/sources.list setf debsources
  391. " ROCKLinux package description
  392. au BufNewFile,BufRead *.desc setf desc
  393. " the D language
  394. au BufNewFile,BufRead *.d setf d
  395. " Desktop files
  396. au BufNewFile,BufRead *.desktop,.directory setf desktop
  397. " Dict config
  398. au BufNewFile,BufRead dict.conf,.dictrc setf dictconf
  399. " Dictd config
  400. au BufNewFile,BufRead dictd.conf setf dictdconf
  401. " Diff files
  402. au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff
  403. " Dircolors
  404. au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors
  405. " Diva (with Skill) or InstallShield
  406. au BufNewFile,BufRead *.rul
  407. \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |
  408. \ setf ishd |
  409. \ else |
  410. \ setf diva |
  411. \ endif
  412. " DCL (Digital Command Language - vms) or DNS zone file
  413. au BufNewFile,BufRead *.com call s:BindzoneCheck('dcl')
  414. " DOT
  415. au BufNewFile,BufRead *.dot setf dot
  416. " Dylan - lid files
  417. au BufNewFile,BufRead *.lid setf dylanlid
  418. " Dylan - intr files (melange)
  419. au BufNewFile,BufRead *.intr setf dylanintr
  420. " Dylan
  421. au BufNewFile,BufRead *.dylan setf dylan
  422. " Microsoft Module Definition
  423. au BufNewFile,BufRead *.def setf def
  424. " Dracula
  425. au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
  426. " dsl
  427. au BufNewFile,BufRead *.dsl setf dsl
  428. " DTD (Document Type Definition for XML)
  429. au BufNewFile,BufRead *.dtd setf dtd
  430. " EDIF (*.edf,*.edif,*.edn,*.edo)
  431. au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif
  432. " Embedix Component Description
  433. au BufNewFile,BufRead *.ecd setf ecd
  434. " Eiffel or Specman
  435. au BufNewFile,BufRead *.e,*.E call s:FTe()
  436. " Elinks configuration
  437. au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks
  438. fun! s:FTe()
  439. let n = 1
  440. while n < 100 && n < line("$")
  441. if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
  442. setf specman
  443. return
  444. endif
  445. let n = n + 1
  446. endwhile
  447. setf eiffel
  448. endfun
  449. " ERicsson LANGuage
  450. au BufNewFile,BufRead *.erl setf erlang
  451. " Elm Filter Rules file
  452. au BufNewFile,BufRead filter-rules setf elmfilt
  453. " ESMTP rc file
  454. au BufNewFile,BufRead *esmtprc setf esmtprc
  455. " ESQL-C
  456. au BufNewFile,BufRead *.ec,*.EC setf esqlc
  457. " Esterel
  458. au BufNewFile,BufRead *.strl setf esterel
  459. " Essbase script
  460. au BufNewFile,BufRead *.csc setf csc
  461. " Exim
  462. au BufNewFile,BufRead exim.conf setf exim
  463. " Expect
  464. au BufNewFile,BufRead *.exp setf expect
  465. " Exports
  466. au BufNewFile,BufRead exports setf exports
  467. " Factor
  468. au BufNewFile,BufRead *.factor setf factor
  469. " Fetchmail RC file
  470. au BufNewFile,BufRead .fetchmailrc setf fetchmail
  471. " FlexWiki
  472. au BufNewFile,BufRead *.wiki setf flexwiki
  473. " Focus Executable
  474. au BufNewFile,BufRead *.fex,*.focexec setf focexec
  475. " Focus Master file (but not for auto.master)
  476. au BufNewFile,BufRead auto.master setf conf
  477. au BufNewFile,BufRead *.mas,*.master setf master
  478. " Forth
  479. au BufNewFile,BufRead *.fs,*.ft setf forth
  480. " Fortran
  481. au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.FPP,*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
  482. " FStab
  483. au BufNewFile,BufRead fstab,mtab setf fstab
  484. " GDB command files
  485. au BufNewFile,BufRead .gdbinit setf gdb
  486. " GDMO
  487. au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
  488. " Gedcom
  489. au BufNewFile,BufRead *.ged setf gedcom
  490. " Gkrellmrc
  491. au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
  492. " GP scripts (2.0 and onward)
  493. au BufNewFile,BufRead *.gp,.gprc setf gp
  494. " GPG
  495. au BufNewFile,BufRead */.gnupg/options setf gpg
  496. au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg
  497. au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
  498. " Gnuplot scripts
  499. au BufNewFile,BufRead *.gpi setf gnuplot
  500. " GrADS scripts
  501. au BufNewFile,BufRead *.gs setf grads
  502. " Gretl
  503. au BufNewFile,BufRead *.gretl setf gretl
  504. " Groovy
  505. au BufNewFile,BufRead *.groovy setf groovy
  506. " GNU Server Pages
  507. au BufNewFile,BufRead *.gsp setf gsp
  508. " Group file
  509. au BufNewFile,BufRead /etc/group setf group
  510. " GTK RC
  511. au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
  512. " Haskell
  513. au BufNewFile,BufRead *.hs setf haskell
  514. au BufNewFile,BufRead *.lhs setf lhaskell
  515. au BufNewFile,BufRead *.chs setf chaskell
  516. " Hercules
  517. au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
  518. " HEX (Intel)
  519. au BufNewFile,BufRead *.hex,*.h32 setf hex
  520. " Tilde (must be before HTML)
  521. au BufNewFile,BufRead *.t.html setf tilde
  522. " HTML (.shtml and .stm for server side)
  523. au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml()
  524. " Distinguish between HTML, XHTML and Django
  525. fun! s:FThtml()
  526. let n = 1
  527. while n < 10 && n < line("$")
  528. if getline(n) =~ '\<DTD\s\+XHTML\s'
  529. setf xhtml
  530. return
  531. endif
  532. if getline(n) =~ '{%\s*\(extends\|block\)\>'
  533. setf htmldjango
  534. return
  535. endif
  536. let n = n + 1
  537. endwhile
  538. setf html
  539. endfun
  540. " HTML with Ruby - eRuby
  541. au BufNewFile,BufRead *.rhtml setf eruby
  542. " HTML with M4
  543. au BufNewFile,BufRead *.html.m4 setf htmlm4
  544. " HTML Cheetah template
  545. au BufNewFile,BufRead *.tmpl setf htmlcheetah
  546. " Hyper Builder
  547. au BufNewFile,BufRead *.hb setf hb
  548. " Icon
  549. au BufNewFile,BufRead *.icn setf icon
  550. " IDL (Interface Description Language)
  551. au BufNewFile,BufRead *.idl call s:FTidl()
  552. " Distinguish between standard IDL and MS-IDL
  553. fun! s:FTidl()
  554. let n = 1
  555. while n < 50 && n < line("$")
  556. if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
  557. setf msidl
  558. return
  559. endif
  560. let n = n + 1
  561. endwhile
  562. setf idl
  563. endfun
  564. " Microsoft IDL (Interface Description Language) Also *.idl
  565. " MOF = WMI (Windows Management Instrumentation) Managed Object Format
  566. au BufNewFile,BufRead *.odl,*.mof setf msidl
  567. " Icewm menu
  568. au BufNewFile,BufRead */.icewm/menu setf icemenu
  569. " IDL (Interactive Data Language)
  570. au BufNewFile,BufRead *.pro setf idlang
  571. " Indent RC
  572. au BufNewFile,BufRead indentrc setf indentrc
  573. " Inform
  574. au BufNewFile,BufRead .indent.pro setf indent
  575. " Inform
  576. au BufNewFile,BufRead *.inf,*.INF setf inform
  577. " Ipfilter
  578. au BufNewFile,BufRead ipf.conf,ipf.rules setf ipfilter
  579. " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
  580. au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
  581. " .INI file for MSDOS
  582. au BufNewFile,BufRead *.ini setf dosini
  583. " SysV Inittab
  584. au BufNewFile,BufRead inittab setf inittab
  585. " Inno Setup
  586. au BufNewFile,BufRead *.iss setf iss
  587. " JAL
  588. au BufNewFile,BufRead *.jal,*.JAL setf jal
  589. " Jam
  590. au BufNewFile,BufRead *.jpl,*.jpr setf jam
  591. " Java
  592. au BufNewFile,BufRead *.java,*.jav setf java
  593. " JavaCC
  594. au BufNewFile,BufRead *.jj,*.jjt setf javacc
  595. " JavaScript
  596. au BufNewFile,BufRead *.js,*.javascript setf javascript
  597. " Java Server Pages
  598. au BufNewFile,BufRead *.jsp setf jsp
  599. " Java Properties resource file (note: doesn't catch font.properties.pl)
  600. au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties
  601. au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties')
  602. " Jess
  603. au BufNewFile,BufRead *.clp setf jess
  604. " Jgraph
  605. au BufNewFile,BufRead *.jgr setf jgraph
  606. " Kixtart
  607. au BufNewFile,BufRead *.kix setf kix
  608. " Kimwitu[++]
  609. au BufNewFile,BufRead *.k setf kwt
  610. " KDE script
  611. au BufNewFile,BufRead *.ks setf kscript
  612. " Kconfig
  613. au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig
  614. " Lace (ISE)
  615. au BufNewFile,BufRead *.ace,*.ACE setf lace
  616. " Latte
  617. au BufNewFile,BufRead *.latte,*.lte setf latte
  618. " Limits
  619. au BufNewFile,BufRead /etc/limits setf limits
  620. " LambdaProlog (*.mod too, see Modsim)
  621. au BufNewFile,BufRead *.sig setf lprolog
  622. " LDAP LDIF
  623. au BufNewFile,BufRead *.ldif setf ldif
  624. " Ld loader
  625. au BufNewFile,BufRead *.ld setf ld
  626. " Lex
  627. au BufNewFile,BufRead *.lex,*.l setf lex
  628. " Libao
  629. au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao
  630. " Libsensors
  631. au BufNewFile,BufRead /etc/sensors.conf setf sensors
  632. " LFTP
  633. au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
  634. " Lifelines (or Lex for C++!)
  635. au BufNewFile,BufRead *.ll setf lifelines
  636. " Lilo: Linux loader
  637. au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
  638. " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
  639. if has("fname_case")
  640. au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
  641. else
  642. au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
  643. endif
  644. " SBCL implementation of Common Lisp
  645. au BufNewFile,BufRead sbclrc,.sbclrc setf lisp
  646. " Lite
  647. au BufNewFile,BufRead *.lite,*.lt setf lite
  648. " Login access
  649. au BufNewFile,BufRead /etc/login.access setf loginaccess
  650. " Login defs
  651. au BufNewFile,BufRead /etc/login.defs setf logindefs
  652. " Logtalk
  653. au BufNewFile,BufRead *.lgt setf logtalk
  654. " LOTOS
  655. au BufNewFile,BufRead *.lot,*.lotos setf lotos
  656. " Lout (also: *.lt)
  657. au BufNewFile,BufRead *.lou,*.lout setf lout
  658. " Lua
  659. au BufNewFile,BufRead *.lua setf lua
  660. " Lynx style file (or LotusScript!)
  661. au BufNewFile,BufRead *.lss setf lss
  662. " M4
  663. au BufNewFile,BufRead *.m4
  664. \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif
  665. " MaGic Point
  666. au BufNewFile,BufRead *.mgp setf mgp
  667. " Mail (for Elm, trn, mutt, rn, slrn)
  668. au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
  669. " Mail aliases
  670. au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases
  671. " Mailcap configuration file
  672. au BufNewFile,BufRead .mailcap,mailcap setf mailcap
  673. " Makefile
  674. au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
  675. " MakeIndex
  676. au BufNewFile,BufRead *.ist,*.mst setf ist
  677. " Manpage
  678. au BufNewFile,BufRead *.man setf man
  679. " Man config
  680. au BufNewFile,BufRead /etc/man.conf,man.config setf manconf
  681. " Maple V
  682. au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
  683. " Mason
  684. au BufNewFile,BufRead *.mason,*.mhtml setf mason
  685. " Matlab or Objective C
  686. au BufNewFile,BufRead *.m call s:FTm()
  687. fun! s:FTm()
  688. let n = 1
  689. while n < 10
  690. let line = getline(n)
  691. if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
  692. setf objc
  693. return
  694. endif
  695. if line =~ '^\s*%'
  696. setf matlab
  697. return
  698. endif
  699. if line =~ '^\s*(\*'
  700. setf mma
  701. return
  702. endif
  703. let n = n + 1
  704. endwhile
  705. if exists("g:filetype_m")
  706. exe "setf " . g:filetype_m
  707. else
  708. setf matlab
  709. endif
  710. endfun
  711. " Maya Extension Language
  712. au BufNewFile,BufRead *.mel setf mel
  713. " Metafont
  714. au BufNewFile,BufRead *.mf setf mf
  715. " MetaPost
  716. au BufNewFile,BufRead *.mp setf mp
  717. " MGL
  718. au BufNewFile,BufRead *.mgl setf mgl
  719. " MMIX or VMS makefile
  720. au BufNewFile,BufRead *.mms call s:FTmms()
  721. fun! s:FTmms()
  722. let n = 1
  723. while n < 10
  724. let line = getline(n)
  725. if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
  726. setf mmix
  727. return
  728. endif
  729. if line =~ '^\s*#'
  730. setf make
  731. return
  732. endif
  733. let n = n + 1
  734. endwhile
  735. setf mmix
  736. endfun
  737. " Modsim III (or LambdaProlog)
  738. au BufNewFile,BufRead *.mod
  739. \ if getline(1) =~ '\<module\>' |
  740. \ setf lprolog |
  741. \ else |
  742. \ setf modsim3 |
  743. \ endif
  744. " Modula 2
  745. au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
  746. " Modula 3 (.m3, .i3, .mg, .ig)
  747. au BufNewFile,BufRead *.[mi][3g] setf modula3
  748. " Monk
  749. au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
  750. " MOO
  751. au BufNewFile,BufRead *.moo setf moo
  752. " Modconf
  753. au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf
  754. au BufNewFile,BufRead /etc/modutils/*
  755. \ if executable(expand("<afile>")) != 1
  756. \| call s:StarSetf('modconf')
  757. \|endif
  758. " Mplayer config
  759. au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf
  760. " Moterola S record
  761. au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec
  762. " Mrxvtrc
  763. au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc
  764. " Msql
  765. au BufNewFile,BufRead *.msql setf msql
  766. " Mysql
  767. au BufNewFile,BufRead *.mysql setf mysql
  768. " M$ Resource files
  769. au BufNewFile,BufRead *.rc setf rc
  770. " MuPAD source
  771. au BufRead,BufNewFile *.mu setf mupad
  772. " Mush
  773. au BufNewFile,BufRead *.mush setf mush
  774. " Mutt setup file
  775. au BufNewFile,BufRead Mutt{ng,}rc setf muttrc
  776. au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc')
  777. " Nano
  778. au BufNewFile,BufRead /etc/nanorc,.nanorc setf nanorc
  779. " Nastran input/DMAP
  780. "au BufNewFile,BufRead *.dat setf nastran
  781. " Natural
  782. au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
  783. " Netrc
  784. au BufNewFile,BufRead .netrc setf netrc
  785. " Novell netware batch files
  786. au BufNewFile,BufRead *.ncf setf ncf
  787. " Nroff/Troff (*.ms and *.t are checked below)
  788. au BufNewFile,BufRead *.me
  789. \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |
  790. \ setf nroff |
  791. \ endif
  792. au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
  793. au BufNewFile,BufRead *.[1-9] call s:FTnroff()
  794. " This function checks if one of the first five lines start with a dot. In
  795. " that case it is probably an nroff file: 'filetype' is set and 1 is returned.
  796. fun! s:FTnroff()
  797. if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
  798. setf nroff
  799. return 1
  800. endif
  801. return 0
  802. endfun
  803. " Nroff or Objective C++
  804. au BufNewFile,BufRead *.mm call s:FTmm()
  805. fun! s:FTmm()
  806. let n = 1
  807. while n < 10
  808. let line = getline(n)
  809. if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
  810. setf objcpp
  811. return
  812. endif
  813. let n = n + 1
  814. endwhile
  815. setf nroff
  816. endfun
  817. " Not Quite C
  818. au BufNewFile,BufRead *.nqc setf nqc
  819. " NSIS
  820. au BufNewFile,BufRead *.nsi setf nsis
  821. " OCAML
  822. au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml
  823. " Occam
  824. au BufNewFile,BufRead *.occ setf occam
  825. " Omnimark
  826. au BufNewFile,BufRead *.xom,*.xin setf omnimark
  827. " OpenROAD
  828. au BufNewFile,BufRead *.or setf openroad
  829. " OPL
  830. au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
  831. " Oracle config file
  832. au BufNewFile,BufRead *.ora setf ora
  833. " Packet filter conf
  834. au BufNewFile,BufRead pf.conf setf pf
  835. " Pam conf
  836. au BufNewFile,BufRead /etc/pam.conf setf pamconf
  837. " PApp
  838. au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
  839. " Password file
  840. au BufNewFile,BufRead /etc/passwd,/etc/shadow,/etc/shadow- setf passwd
  841. " Pascal (also *.p)
  842. au BufNewFile,BufRead *.pas setf pascal
  843. " Delphi project file
  844. au BufNewFile,BufRead *.dpr setf pascal
  845. " Perl
  846. if has("fname_case")
  847. au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
  848. else
  849. au BufNewFile,BufRead *.pl call s:FTpl()
  850. endif
  851. au BufNewFile,BufRead *.plx setf perl
  852. fun! s:FTpl()
  853. if exists("g:filetype_pl")
  854. exe "setf " . g:filetype_pl
  855. else
  856. " recognize Prolog by specific text in the first non-empty line
  857. " require a blank after the '%' because Perl uses "%list" and "%translate"
  858. let l = getline(nextnonblank(1))
  859. if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
  860. setf prolog
  861. else
  862. setf perl
  863. endif
  864. endif
  865. endfun
  866. " Perl, XPM or XPM2
  867. au BufNewFile,BufRead *.pm
  868. \ if getline(1) =~ "XPM2" |
  869. \ setf xpm2 |
  870. \ elseif getline(1) =~ "XPM" |
  871. \ setf xpm |
  872. \ else |
  873. \ setf perl |
  874. \ endif
  875. " Perl POD
  876. au BufNewFile,BufRead *.pod setf pod
  877. " Php, php3, php4, etc.
  878. au BufNewFile,BufRead *.php,*.php\d setf php
  879. " Phtml
  880. au BufNewFile,BufRead *.phtml setf phtml
  881. " Pike
  882. au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike
  883. " Pinfo config
  884. au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo
  885. " Palm Resource compiler
  886. au BufNewFile,BufRead *.rcp setf pilrc
  887. " Pine config
  888. au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine
  889. " PL/M (also: *.inp)
  890. au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm
  891. " PL/SQL
  892. au BufNewFile,BufRead *.pls,*.plsql setf plsql
  893. " PLP
  894. au BufNewFile,BufRead *.plp setf plp
  895. " PO and PO template (GNU gettext)
  896. au BufNewFile,BufRead *.po,*.pot setf po
  897. " Postfix main config
  898. au BufNewFile,BufRead main.cf setf pfmain
  899. " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
  900. au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr
  901. " PostScript Printer Description
  902. au BufNewFile,BufRead *.ppd setf ppd
  903. " Povray
  904. au BufNewFile,BufRead *.pov setf pov
  905. " Povray configuration
  906. au BufNewFile,BufRead .povrayrc setf povini
  907. " Povray, PHP or assembly
  908. au BufNewFile,BufRead *.inc call s:FTinc()
  909. fun! s:FTinc()
  910. if exists("g:filetype_inc")
  911. exe "setf " . g:filetype_inc
  912. else
  913. let lines = getline(1).getline(2).getline(3)
  914. if lines =~? "perlscript"
  915. setf aspperl
  916. elseif lines =~ "<%"
  917. setf aspvbs
  918. elseif lines =~ "<?"
  919. setf php
  920. else
  921. call s:FTasmsyntax()
  922. if exists("b:asmsyntax")
  923. exe "setf " . b:asmsyntax
  924. else
  925. setf pov
  926. endif
  927. endif
  928. endif
  929. endfun
  930. " Printcap and Termcap
  931. au BufNewFile,BufRead *printcap
  932. \ let b:ptcap_type = "print" | setf ptcap
  933. au BufNewFile,BufRead *termcap
  934. \ let b:ptcap_type = "term" | setf ptcap
  935. " PCCTS / ANTRL
  936. "au BufNewFile,BufRead *.g setf antrl
  937. au BufNewFile,BufRead *.g setf pccts
  938. " PPWizard
  939. au BufNewFile,BufRead *.it,*.ih setf ppwiz
  940. " Oracle Pro*C/C++
  941. au BufNewFile,BufRead .pc setf proc
  942. " Procmail
  943. au BufNewFile,BufRead .procmail,.procmailrc setf procmail
  944. " Progress or CWEB
  945. au BufNewFile,BufRead *.w call s:FTprogress_cweb()
  946. function! s:FTprogress_cweb()
  947. if exists("g:filetype_w")
  948. exe "setf " . g:filetype_w
  949. return
  950. endif
  951. if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
  952. setf progress
  953. else
  954. setf cweb
  955. endif
  956. endfun
  957. " Progress or assembly
  958. au BufNewFile,BufRead *.i call s:FTprogress_asm()
  959. function! s:FTprogress_asm()
  960. if exists("g:filetype_i")
  961. exe "setf " . g:filetype_i
  962. return
  963. endif
  964. " This function checks for an assembly comment the first ten lines.
  965. " If not found, assume Progress.
  966. let lnum = 1
  967. while lnum <= 10 && lnum < line('$')
  968. let line = getline(lnum)
  969. if line =~ '^\s*;' || line =~ '^\*'
  970. call s:FTasm()
  971. return
  972. elseif line !~ '^\s*$' || line =~ '^/\*'
  973. " Not an empty line: Doesn't look like valid assembly code.
  974. " Or it looks like a Progress /* comment
  975. break
  976. endif
  977. let lnum = lnum + 1
  978. endw
  979. setf progress
  980. endfun
  981. " Progress or Pascal
  982. au BufNewFile,BufRead *.p call s:FTprogress_pascal()
  983. function! s:FTprogress_pascal()
  984. if exists("g:filetype_p")
  985. exe "setf " . g:filetype_p
  986. return
  987. endif
  988. " This function checks for valid Pascal syntax in the first ten lines.
  989. " Look for either an opening comment or a program start.
  990. " If not found, assume Progress.
  991. let lnum = 1
  992. while lnum <= 10 && lnum < line('$')
  993. let line = getline(lnum)
  994. if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'
  995. \ || line =~ '^\s*{' || line =~ '^\s*(\*'
  996. setf pascal
  997. return
  998. elseif line !~ '^\s*$' || line =~ '^/\*'
  999. " Not an empty line: Doesn't look like valid Pascal code.
  1000. " Or it looks like a Progress /* comment
  1001. break
  1002. endif
  1003. let lnum = lnum + 1
  1004. endw
  1005. setf progress
  1006. endfun
  1007. " Software Distributor Product Specification File (POSIX 1387.2-1995)
  1008. au BufNewFile,BufRead *.psf setf psf
  1009. au BufNewFile,BufRead INDEX,INFO
  1010. \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |
  1011. \ setf psf |
  1012. \ endif
  1013. " Prolog
  1014. au BufNewFile,BufRead *.pdb setf prolog
  1015. " Protocols
  1016. au BufNewFile,BufRead /etc/protocols setf protocols
  1017. " Pyrex
  1018. au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
  1019. " Python
  1020. au BufNewFile,BufRead *.py,*.pyw setf python
  1021. " Radiance
  1022. au BufNewFile,BufRead *.rad,*.mat setf radiance
  1023. " Ratpoison config/command files
  1024. au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison
  1025. " RCS file
  1026. au BufNewFile,BufRead *\,v setf rcs
  1027. " Readline
  1028. au BufNewFile,BufRead .inputrc,inputrc setf readline
  1029. " Registry for MS-Windows
  1030. au BufNewFile,BufRead *.reg
  1031. \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
  1032. " Renderman Interface Bytestream
  1033. au BufNewFile,BufRead *.rib setf rib
  1034. " Rexx
  1035. au BufNewFile,BufRead *.rexx,*.rex setf rexx
  1036. " R (Splus)
  1037. if has("fname_case")
  1038. au BufNewFile,BufRead *.s,*.S setf r
  1039. else
  1040. au BufNewFile,BufRead *.s setf r
  1041. endif
  1042. " R Help file
  1043. if has("fname_case")
  1044. au BufNewFile,BufRead *.rd,*.Rd setf rhelp
  1045. else
  1046. au BufNewFile,BufRead *.rd setf rhelp
  1047. endif
  1048. " R noweb file
  1049. if has("fname_case")
  1050. au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw setf rnoweb
  1051. else
  1052. au BufNewFile,BufRead *.rnw,*.snw setf rnoweb
  1053. endif
  1054. " Rexx, Rebol or R
  1055. au BufNewFile,BufRead *.r,*.R call s:FTr()
  1056. fun! s:FTr()
  1057. if getline(1) =~ '^REBOL'
  1058. setf rebol
  1059. else
  1060. let n = 1
  1061. let max = line("$")
  1062. if max > 50
  1063. let max = 50
  1064. endif
  1065. while n < max
  1066. " R has # comments
  1067. if getline(n) =~ '^\s*#'
  1068. setf r
  1069. break
  1070. endif
  1071. " Rexx has /* comments */
  1072. if getline(n) =~ '^\s*/\*'
  1073. setf rexx
  1074. break
  1075. endif
  1076. let n = n + 1
  1077. endwhile
  1078. if n >= max
  1079. setf rexx
  1080. endif
  1081. endif
  1082. endfun
  1083. " Remind
  1084. au BufNewFile,BufRead .reminders* call s:StarSetf('remind')
  1085. " Resolv.conf
  1086. au BufNewFile,BufRead resolv.conf setf resolv
  1087. " Relax NG Compact
  1088. au BufNewFile,BufRead *.rnc setf rnc
  1089. " RPL/2
  1090. au BufNewFile,BufRead *.rpl setf rpl
  1091. " Robots.txt
  1092. au BufNewFile,BufRead robots.txt setf robots
  1093. " Rpcgen
  1094. au BufNewFile,BufRead *.x setf rpcgen
  1095. " reStructuredText Documentation Format
  1096. au BufNewFile,BufRead *.rst setf rst
  1097. " RTF
  1098. au BufNewFile,BufRead *.rtf setf rtf
  1099. " Ruby
  1100. au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby
  1101. " Rantfile is like Ruby
  1102. au BufNewFile,BufRead [rR]antfile,*.rant setf ruby
  1103. " S-lang (or shader language!)
  1104. au BufNewFile,BufRead *.sl setf slang
  1105. " Samba config
  1106. au BufNewFile,BufRead smb.conf setf samba
  1107. " SAS script
  1108. au BufNewFile,BufRead *.sas setf sas
  1109. " Sather
  1110. au BufNewFile,BufRead *.sa setf sather
  1111. " Scilab
  1112. au BufNewFile,BufRead *.sci,*.sce setf scilab
  1113. " SDL
  1114. au BufNewFile,BufRead *.sdl,*.pr setf sdl
  1115. " sed
  1116. au BufNewFile,BufRead *.sed setf sed
  1117. " Sieve (RFC 3028)
  1118. au BufNewFile,BufRead *.siv setf sieve
  1119. " Sendmail
  1120. au BufNewFile,BufRead sendmail.cf setf sm
  1121. " Sendmail .mc files are actually m4
  1122. au BufNewFile,BufRead *.mc setf m4
  1123. " Services
  1124. au BufNewFile,BufRead /etc/services setf services
  1125. " Service Location config
  1126. au BufNewFile,BufRead /etc/slp.conf setf slpconf
  1127. " Service Location registration
  1128. au BufNewFile,BufRead /etc/slp.reg setf slpreg
  1129. " Service Location SPI
  1130. au BufNewFile,BufRead /etc/slp.spi setf slpspi
  1131. " Setserial config
  1132. au BufNewFile,BufRead /etc/serial.conf setf setserial
  1133. " SGML
  1134. au BufNewFile,BufRead *.sgm,*.sgml
  1135. \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
  1136. \ setf sgmllnx |
  1137. \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
  1138. \ let b:docbk_type="sgml" |
  1139. \ setf docbk |
  1140. \ else |
  1141. \ setf sgml |
  1142. \ endif
  1143. " SGMLDECL
  1144. au BufNewFile,BufRead *.decl,*.dcl,*.dec
  1145. \ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
  1146. \ setf sgmldecl |
  1147. \ endif
  1148. " SGML catalog file
  1149. au BufNewFile,BufRead catalog setf catalog
  1150. au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
  1151. " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
  1152. " Gentoo ebuilds are actually bash scripts
  1153. au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")
  1154. au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
  1155. au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
  1156. " Also called from scripts.vim.
  1157. fun! SetFileTypeSH(name)
  1158. if expand("<amatch>") =~ g:ft_ignore_pat
  1159. return
  1160. endif
  1161. if a:name =~ '\<ksh\>'
  1162. let b:is_kornshell = 1
  1163. if exists("b:is_bash")
  1164. unlet b:is_bash
  1165. endif
  1166. if exists("b:is_sh")
  1167. unlet b:is_sh
  1168. endif
  1169. elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
  1170. let b:is_bash = 1
  1171. if exists("b:is_kornshell")
  1172. unlet b:is_kornshell
  1173. endif
  1174. if exists("b:is_sh")
  1175. unlet b:is_sh
  1176. endif
  1177. elseif a:name =~ '\<sh\>'
  1178. let b:is_sh = 1
  1179. if exists("b:is_kornshell")
  1180. unlet b:is_kornshell
  1181. endif
  1182. if exists("b:is_bash")
  1183. unlet b:is_bash
  1184. endif
  1185. endif
  1186. call SetFileTypeShell("sh")
  1187. endfun
  1188. " For shell-like file types, check for an "exec" command hidden in a comment,
  1189. " as used for Tcl.
  1190. " Also called from scripts.vim, thus can't be local to this script.
  1191. fun! SetFileTypeShell(name)
  1192. if expand("<amatch>") =~ g:ft_ignore_pat
  1193. return
  1194. endif
  1195. let l = 2
  1196. while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
  1197. " Skip empty and comment lines.
  1198. let l = l + 1
  1199. endwhile
  1200. if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
  1201. " Found an "exec" line after a comment with continuation
  1202. let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '')
  1203. if n =~ '\<tclsh\|\<wish'
  1204. setf tcl
  1205. return
  1206. endif
  1207. endif
  1208. exe "setf " . a:name
  1209. endfun
  1210. " tcsh scripts
  1211. au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh")
  1212. " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
  1213. au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH()
  1214. fun! s:CSH()
  1215. if exists("g:filetype_csh")
  1216. call SetFileTypeShell(g:filetype_csh)
  1217. elseif &shell =~ "tcsh"
  1218. call SetFileTypeShell("tcsh")
  1219. else
  1220. call SetFileTypeShell("csh")
  1221. endif
  1222. endfun
  1223. " Z-Shell script
  1224. au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh
  1225. au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')
  1226. " Scheme
  1227. au BufNewFile,BufRead *.scm,*.ss setf scheme
  1228. " Screen RC
  1229. au BufNewFile,BufRead .screenrc,screenrc setf screen
  1230. " Simula
  1231. au BufNewFile,BufRead *.sim setf simula
  1232. " SINDA
  1233. au BufNewFile,BufRead *.sin,*.s85 setf sinda
  1234. " SiSU
  1235. au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisu
  1236. au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu
  1237. " SKILL
  1238. au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill
  1239. " SLRN
  1240. au BufNewFile,BufRead .slrnrc setf slrnrc
  1241. au BufNewFile,BufRead *.score setf slrnsc
  1242. " Smalltalk (and TeX)
  1243. au BufNewFile,BufRead *.st setf st
  1244. au BufNewFile,BufRead *.cls
  1245. \ if getline(1) =~ '^%' |
  1246. \ setf tex |
  1247. \ else |
  1248. \ setf st |
  1249. \ endif
  1250. " Smarty templates
  1251. au BufNewFile,BufRead *.tpl setf smarty
  1252. " SMIL or XML
  1253. au BufNewFile,BufRead *.smil
  1254. \ if getline(1) =~ '<?\s*xml.*?>' |
  1255. \ setf xml |
  1256. \ else |
  1257. \ setf smil |
  1258. \ endif
  1259. " SMIL or SNMP MIB file
  1260. au BufNewFile,BufRead *.smi
  1261. \ if getline(1) =~ '\<smil\>' |
  1262. \ setf smil |
  1263. \ else |
  1264. \ setf mib |
  1265. \ endif
  1266. " SMITH
  1267. au BufNewFile,BufRead *.smt,*.smith setf smith
  1268. " Snobol4 and spitbol
  1269. au BufNewFile,BufRead *.sno,*.spt setf snobol4
  1270. " SNMP MIB files
  1271. au BufNewFile,BufRead *.mib,*.my setf mib
  1272. " Snort Configuration
  1273. au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog
  1274. " Spec (Linux RPM)
  1275. au BufNewFile,BufRead *.spec setf spec
  1276. " Speedup (AspenTech plant simulator)
  1277. au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup
  1278. " Slice
  1279. au BufNewFile,BufRead *.ice setf slice
  1280. " Spice
  1281. au BufNewFile,BufRead *.sp,*.spice setf spice
  1282. " Spyce
  1283. au BufNewFile,BufRead *.spy,*.spi setf spyce
  1284. " Squid
  1285. au BufNewFile,BufRead squid.conf setf squid
  1286. " SQL for Oracle Designer
  1287. au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql
  1288. " SQL
  1289. au BufNewFile,BufRead *.sql call s:SQL()
  1290. fun! s:SQL()
  1291. if exists("g:filetype_sql")
  1292. exe "setf " . g:filetype_sql
  1293. else
  1294. setf sql
  1295. endif
  1296. endfun
  1297. " SQLJ
  1298. au BufNewFile,BufRead *.sqlj setf sqlj
  1299. " SQR
  1300. au BufNewFile,BufRead *.sqr,*.sqi setf sqr
  1301. " OpenSSH configuration
  1302. au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
  1303. " OpenSSH server configuration
  1304. au BufNewFile,BufRead sshd_config setf sshdconfig
  1305. " Stata
  1306. au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata
  1307. " SMCL
  1308. au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl
  1309. " Stored Procedures
  1310. au BufNewFile,BufRead *.stp setf stp
  1311. " Standard ML
  1312. au BufNewFile,BufRead *.sml setf sml
  1313. " Sysctl
  1314. au BufNewFile,BufRead /etc/sysctl.conf setf sysctl
  1315. " Sudoers
  1316. au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers
  1317. " If the file has an extension of 't' and is in a directory 't' then it is
  1318. " almost certainly a Perl test file.
  1319. " If the first line starts with '#' and contains 'perl' it's probably a Perl
  1320. " file.
  1321. " (Slow test) If a file contains a 'use' statement then it is almost certainly
  1322. " a Perl file.
  1323. fun! s:FTperl()
  1324. if expand("%:e") == 't' && expand("%:p:h:t") == 't'
  1325. setf perl
  1326. return 1
  1327. endif
  1328. if getline(1)[0] == '#' && getline(1) =~ 'perl'
  1329. setf perl
  1330. return 1
  1331. endif
  1332. if search('^use\s\s*\k', 'nc', 30)
  1333. setf perl
  1334. return 1
  1335. endif
  1336. return 0
  1337. endfun
  1338. " Tads (or Nroff or Perl test file)
  1339. au BufNewFile,BufRead *.t
  1340. \ if !s:FTnroff() && !s:FTperl() | setf tads | endif
  1341. " Tags
  1342. au BufNewFile,BufRead tags setf tags
  1343. " TAK
  1344. au BufNewFile,BufRead *.tak setf tak
  1345. " Tcl (JACL too)
  1346. au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl
  1347. " TealInfo
  1348. au BufNewFile,BufRead *.tli setf tli
  1349. " Telix Salt
  1350. au BufNewFile,BufRead *.slt setf tsalt
  1351. " Terminfo
  1352. au BufNewFile,BufRead *.ti setf terminfo
  1353. " TeX
  1354. au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
  1355. au BufNewFile,BufRead *.tex call s:FTtex()
  1356. " Choose context, plaintex, or tex (LaTeX) based on these rules:
  1357. " 1. Check the first line of the file for "%&<format>".
  1358. " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
  1359. " 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.
  1360. fun! s:FTtex()
  1361. let firstline = getline(1)
  1362. if firstline =~ '^%&\s*\a\+'
  1363. let format = tolower(matchstr(firstline, '\a\+'))
  1364. let format = substitute(format, 'pdf', '', '')
  1365. if format == 'tex'
  1366. let format = 'plain'
  1367. endif
  1368. else
  1369. " Default value, may be changed later:
  1370. let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
  1371. " Save position, go to the top of the file, find first non-comment line.
  1372. let save_cursor = getpos('.')
  1373. call cursor(1,1)
  1374. let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
  1375. if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
  1376. let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
  1377. let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
  1378. let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
  1379. \ 'cnp', firstNC + 1000)
  1380. if kwline == 1 " lpat matched
  1381. let format = 'latex'
  1382. elseif kwline == 2 " cpat matched
  1383. let format = 'context'
  1384. endif " If neither matched, keep default set above.
  1385. " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
  1386. " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
  1387. " if cline > 0
  1388. " let format = 'context'
  1389. " endif
  1390. " if lline > 0 && (cline == 0 || cline > lline)
  1391. " let format = 'tex'
  1392. " endif
  1393. endif " firstNC
  1394. call setpos('.', save_cursor)
  1395. endif " firstline =~ '^%&\s*\a\+'
  1396. " Translation from formats to file types. TODO: add AMSTeX, RevTex, others?
  1397. if format == 'plain'
  1398. setf plaintex
  1399. elseif format == 'context'
  1400. setf context
  1401. else " probably LaTeX
  1402. setf tex
  1403. endif
  1404. return
  1405. endfun
  1406. " Context
  1407. au BufNewFile,BufRead tex/context/*/*.tex setf context
  1408. " Texinfo
  1409. au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
  1410. " TeX configuration
  1411. au BufNewFile,BufRead texmf.cnf setf texmf
  1412. " Tidy config
  1413. au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
  1414. " TF mud client
  1415. au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
  1416. " TPP - Text Presentation Program
  1417. au BufNewFile,BufReadPost *.tpp setf tpp
  1418. " Trustees
  1419. au BufNewFile,BufRead trustees.conf setf trustees
  1420. " TSS - Geometry
  1421. au BufNewFile,BufReadPost *.tssgm setf tssgm
  1422. " TSS - Optics
  1423. au BufNewFile,BufReadPost *.tssop setf tssop
  1424. " TSS - Command Line (temporary)
  1425. au BufNewFile,BufReadPost *.tsscl setf tsscl
  1426. " Motif UIT/UIL files
  1427. au BufNewFile,BufRead *.uit,*.uil setf uil
  1428. " Udev conf
  1429. au BufNewFile,BufRead /etc/udev/udev.conf setf udevconf
  1430. " Udev rules
  1431. au BufNewFile,BufRead /etc/udev/rules.d/*.rules setf udevrules
  1432. " Udev permissions
  1433. au BufNewFile,BufRead /etc/udev/permissions.d/*.permissions setf udevperm
  1434. "
  1435. " Udev symlinks config
  1436. au BufNewFile,BufRead /etc/udev/cdsymlinks.conf setf sh
  1437. " UnrealScript
  1438. au BufNewFile,BufRead *.uc setf uc
  1439. " Updatedb
  1440. au BufNewFile,BufRead /etc/updatedb.conf setf updatedb
  1441. " Vera
  1442. au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera
  1443. " Verilog HDL
  1444. au BufNewFile,BufRead *.v setf verilog
  1445. " Verilog-AMS HDL
  1446. au BufNewFile,BufRead *.va,*.vams setf verilogams
  1447. " VHDL
  1448. au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl
  1449. au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl')
  1450. " Vim script
  1451. au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim
  1452. " Viminfo file
  1453. au BufNewFile,BufRead .viminfo,_viminfo setf viminfo
  1454. " Virata Config Script File
  1455. au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata
  1456. " Visual Basic (also uses *.bas) or FORM
  1457. au BufNewFile,BufRead *.frm call s:FTVB("form")
  1458. " SaxBasic is close to Visual Basic
  1459. au BufNewFile,BufRead *.sba setf vb
  1460. " Vgrindefs file
  1461. au BufNewFile,BufRead vgrindefs setf vgrindefs
  1462. " VRML V1.0c
  1463. au BufNewFile,BufRead *.wrl setf vrml
  1464. " Webmacro
  1465. au BufNewFile,BufRead *.wm setf webmacro
  1466. " Wget config
  1467. au BufNewFile,BufRead .wgetrc,wgetrc setf wget
  1468. " Website MetaLanguage
  1469. au BufNewFile,BufRead *.wml setf wml
  1470. " Winbatch
  1471. au BufNewFile,BufRead *.wbt setf winbatch
  1472. " WSML
  1473. au BufNewFile,BufRead *.wsml setf wsml
  1474. " WvDial
  1475. au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial
  1476. " CVS RC file
  1477. au BufNewFile,BufRead .cvsrc setf cvsrc
  1478. " CVS commit file
  1479. au BufNewFile,BufRead cvs\d\+ setf cvs
  1480. " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
  1481. " lines in a WEB file).
  1482. au BufNewFile,BufRead *.web
  1483. \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
  1484. \ setf web |
  1485. \ else |
  1486. \ setf winbatch |
  1487. \ endif
  1488. " Windows Scripting Host and Windows Script Component
  1489. au BufNewFile,BufRead *.ws[fc] setf wsh
  1490. " X Pixmap (dynamically sets colors, use BufEnter to make it work better)
  1491. au BufEnter *.xpm
  1492. \ if getline(1) =~ "XPM2" |
  1493. \ setf xpm2 |
  1494. \ else |
  1495. \ setf xpm |
  1496. \ endif
  1497. au BufEnter *.xpm2 setf xpm2
  1498. " XFree86 config
  1499. au BufNewFile,BufRead XF86Config
  1500. \ if getline(1) =~ '\<XConfigurator\>' |
  1501. \ let b:xf86c_xfree86_version = 3 |
  1502. \ endif |
  1503. \ setf xf86conf
  1504. " Xorg config
  1505. au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf
  1506. " Xinetd conf
  1507. au BufNewFile,BufRead /etc/xinetd.conf setf xinetd
  1508. " XS Perl extension interface language
  1509. au BufNewFile,BufRead *.xs setf xs
  1510. " X resources file
  1511. au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
  1512. " Xmath
  1513. au BufNewFile,BufRead *.msc,*.msf setf xmath
  1514. au BufNewFile,BufRead *.ms
  1515. \ if !s:FTnroff() | setf xmath | endif
  1516. " XML
  1517. au BufNewFile,BufRead *.xml
  1518. \ if getline(1) . getline(2) . getline(3) =~ '<!DOCTYPE.*DocBook' |
  1519. \ let b:docbk_type="xml" |
  1520. \ setf docbk |
  1521. \ else |
  1522. \ setf xml |
  1523. \ endif
  1524. " XMI (holding UML models) is also XML
  1525. au BufNewFile,BufRead *.xmi setf xml
  1526. " CSPROJ files are Visual Studio.NET's XML-based project config files
  1527. au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
  1528. " Qt Linguist translation source and Qt User Interface Files are XML
  1529. au BufNewFile,BufRead *.ts,*.ui setf xml
  1530. " Xdg menus
  1531. au BufNewFile,BufRead /etc/xdg/menus/*.menu setf xml
  1532. " Xquery
  1533. au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy setf xquery
  1534. " XSD
  1535. au BufNewFile,BufRead *.xsd setf xsd
  1536. " Xslt
  1537. au BufNewFile,BufRead *.xsl,*.xslt setf xslt
  1538. " Yacc
  1539. au BufNewFile,BufRead *.yy setf yacc
  1540. " Yacc or racc
  1541. au BufNewFile,BufRead *.y call s:FTy()
  1542. fun! s:FTy()
  1543. let n = 1
  1544. while n < 100 && n < line("$")
  1545. let line = getline(n)
  1546. if line =~ '^\s*%'
  1547. setf yacc
  1548. return
  1549. endif
  1550. if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include'
  1551. setf racc
  1552. return
  1553. endif
  1554. let n = n + 1
  1555. endwhile
  1556. setf yacc
  1557. endfun
  1558. " Yaml
  1559. au BufNewFile,BufRead *.yaml,*.yml setf yaml
  1560. " Zope
  1561. " dtml (zope dynamic template markup language), pt (zope page template),
  1562. " cpt (zope form controller page template)
  1563. au BufNewFile,BufRead *.dtml,*.pt,*.cpt call s:FThtml()
  1564. " zsql (zope sql method)
  1565. au BufNewFile,BufRead *.zsql call s:SQL()
  1566. " Z80 assembler asz80
  1567. au BufNewFile,BufRead *.z8a setf z8a
  1568. augroup END
  1569. " Source the user-specified filetype file, for backwards compatibility with
  1570. " Vim 5.x.
  1571. if exists("myfiletypefile") && filereadable(expand(myfiletypefile))
  1572. execute "source " . myfiletypefile
  1573. endif
  1574. " Check for "*" after loading myfiletypefile, so that scripts.vim is only used
  1575. " when there are no matching file name extensions.
  1576. " Don't do this for compressed files.
  1577. augroup filetypedetect
  1578. au BufNewFile,BufRead *
  1579. \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
  1580. \ | runtime! scripts.vim | endif
  1581. au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
  1582. " Extra checks for when no filetype has been detected now. Mostly used for
  1583. " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim
  1584. " script file.
  1585. " Most of these should call s:StarSetf() to avoid names ending in .gz and the
  1586. " like are used.
  1587. " Asterisk config file
  1588. au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk')
  1589. au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm')
  1590. " BIND zone
  1591. au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone')
  1592. " Changelog
  1593. au BufNewFile,BufRead [cC]hange[lL]og*
  1594. \ if getline(1) =~ '; urgency='
  1595. \| call s:StarSetf('debchangelog')
  1596. \|else
  1597. \| call s:StarSetf('changelog')
  1598. \|endif
  1599. " Crontab
  1600. au BufNewFile,BufRead crontab,crontab.* call s:StarSetf('crontab')
  1601. " D…

Large files files are truncated, but you can click here to view the full file