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