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