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