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