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