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