1" Vim support file to detect file types 2" 3" Maintainer: Bram Moolenaar <[email protected]> 4" Last Change: 2006 Apr 04 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" Lace (ISE) 788au BufNewFile,BufRead *.ace,*.ACE setf lace 789 790" Latte 791au BufNewFile,BufRead *.latte,*.lte setf latte 792 793" Limits 794au BufNewFile,BufRead /etc/limits setf limits 795 796" LambdaProlog (*.mod too, see Modsim) 797au BufNewFile,BufRead *.sig setf lprolog 798 799" LDAP LDIF 800au BufNewFile,BufRead *.ldif setf ldif 801 802" Ld loader 803au BufNewFile,BufRead *.ld setf ld 804 805" Lex 806au BufNewFile,BufRead *.lex,*.l setf lex 807 808" Libao 809au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao 810 811" Libsensors 812au BufNewFile,BufRead /etc/sensors.conf setf sensors 813 814" LFTP 815au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp 816 817" Lifelines (or Lex for C++!) 818au BufNewFile,BufRead *.ll setf lifelines 819 820" Lilo: Linux loader 821au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') 822 823" Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) 824if has("fname_case") 825 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp 826else 827 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp 828endif 829 830" SBCL implementation of Common Lisp 831au BufNewFile,BufRead sbclrc,.sbclrc setf lisp 832 833" Lite 834au BufNewFile,BufRead *.lite,*.lt setf lite 835 836" Login access 837au BufNewFile,BufRead /etc/login.access setf loginaccess 838 839" Login defs 840au BufNewFile,BufRead /etc/login.defs setf logindefs 841 842" Logtalk 843au BufNewFile,BufRead *.lgt setf logtalk 844 845" LOTOS 846au BufNewFile,BufRead *.lot,*.lotos setf lotos 847 848" Lout (also: *.lt) 849au BufNewFile,BufRead *.lou,*.lout setf lout 850 851" Lua 852au BufNewFile,BufRead *.lua setf lua 853 854" Lynx style file (or LotusScript!) 855au BufNewFile,BufRead *.lss setf lss 856 857" M4 858au BufNewFile,BufRead *.m4 859 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif 860 861" MaGic Point 862au BufNewFile,BufRead *.mgp setf mgp 863 864" Mail (for Elm, trn, mutt, rn, slrn) 865au 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 866 867" Mail aliases 868au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases 869 870" Mailcap configuration file 871au BufNewFile,BufRead .mailcap,mailcap setf mailcap 872 873" Makefile 874au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make 875 876" MakeIndex 877au BufNewFile,BufRead *.ist,*.mst setf ist 878 879" Manpage 880au BufNewFile,BufRead *.man setf man 881 882" Man config 883au BufNewFile,BufRead /etc/man.conf,man.config setf manconf 884 885" Maple V 886au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple 887 888" Mason 889au BufNewFile,BufRead *.mason,*.mhtml setf mason 890 891" Matlab or Objective C 892au BufNewFile,BufRead *.m call s:FTm() 893 894fun! s:FTm() 895 let n = 1 896 while n < 10 897 let line = getline(n) 898 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' 899 setf objc 900 return 901 endif 902 if line =~ '^\s*%' 903 setf matlab 904 return 905 endif 906 if line =~ '^\s*(\*' 907 setf mma 908 return 909 endif 910 let n = n + 1 911 endwhile 912 if exists("g:filetype_m") 913 exe "setf " . g:filetype_m 914 else 915 setf matlab 916 endif 917endfun 918 919" Maya Extension Language 920au BufNewFile,BufRead *.mel setf mel 921 922" Metafont 923au BufNewFile,BufRead *.mf setf mf 924 925" MetaPost 926au BufNewFile,BufRead *.mp setf mp 927 928" MGL 929au BufNewFile,BufRead *.mgl setf mgl 930 931" MMIX or VMS makefile 932au BufNewFile,BufRead *.mms call s:FTmms() 933 934fun! s:FTmms() 935 let n = 1 936 while n < 10 937 let line = getline(n) 938 if line =~ '^\s*\(%\|//\)' || line =~ '^\*' 939 setf mmix 940 return 941 endif 942 if line =~ '^\s*#' 943 setf make 944 return 945 endif 946 let n = n + 1 947 endwhile 948 setf mmix 949endfun 950 951 952" Modsim III (or LambdaProlog) 953au BufNewFile,BufRead *.mod 954 \ if getline(1) =~ '\<module\>' | 955 \ setf lprolog | 956 \ else | 957 \ setf modsim3 | 958 \ endif 959 960" Modula 2 961au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2 962 963" Modula 3 (.m3, .i3, .mg, .ig) 964au BufNewFile,BufRead *.[mi][3g] setf modula3 965 966" Monk 967au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk 968 969" MOO 970au BufNewFile,BufRead *.moo setf moo 971 972" Modconf 973au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf 974au BufNewFile,BufRead /etc/modutils/* 975 \ if executable(expand("<afile>")) != 1 976 \| call s:StarSetf('modconf') 977 \|endif 978 979" Mplayer config 980au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf 981 982" Moterola S record 983au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec 984 985" Msql 986au BufNewFile,BufRead *.msql setf msql 987 988" Mysql 989au BufNewFile,BufRead *.mysql setf mysql 990 991" M$ Resource files 992au BufNewFile,BufRead *.rc setf rc 993 994" MuPAD source 995au BufRead,BufNewFile *.mu setf mupad 996 997" Mush 998au BufNewFile,BufRead *.mush setf mush 999 1000" Mutt setup file 1001au BufNewFile,BufRead Mutt{ng,}rc setf muttrc 1002au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') 1003 1004" Nano 1005au BufNewFile,BufRead /etc/nanorc,.nanorc setf nanorc 1006 1007" Nastran input/DMAP 1008"au BufNewFile,BufRead *.dat setf nastran 1009 1010" Natural 1011au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural 1012 1013" Netrc 1014au BufNewFile,BufRead .netrc setf netrc 1015 1016" Novell netware batch files 1017au BufNewFile,BufRead *.ncf setf ncf 1018 1019" Nroff/Troff (*.ms and *.t are checked below) 1020au BufNewFile,BufRead *.me 1021 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" | 1022 \ setf nroff | 1023 \ endif 1024au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff 1025au BufNewFile,BufRead *.[1-9] call s:FTnroff() 1026 1027" This function checks if one of the first five lines start with a dot. In 1028" that case it is probably an nroff file: 'filetype' is set and 1 is returned. 1029fun! s:FTnroff() 1030 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' 1031 setf nroff 1032 return 1 1033 endif 1034 return 0 1035endfun 1036 1037" Nroff or Objective C++ 1038au BufNewFile,BufRead *.mm call s:FTmm() 1039 1040fun! s:FTmm() 1041 let n = 1 1042 while n < 10 1043 let line = getline(n) 1044 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' 1045 setf objcpp 1046 return 1047 endif 1048 let n = n + 1 1049 endwhile 1050 setf nroff 1051endfun 1052 1053" Not Quite C 1054au BufNewFile,BufRead *.nqc setf nqc 1055 1056" NSIS 1057au BufNewFile,BufRead *.nsi setf nsis 1058 1059" OCAML 1060au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml 1061 1062" Occam 1063au BufNewFile,BufRead *.occ setf occam 1064 1065" Omnimark 1066au BufNewFile,BufRead *.xom,*.xin setf omnimark 1067 1068" OpenROAD 1069au BufNewFile,BufRead *.or setf openroad 1070 1071" OPL 1072au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl 1073 1074" Oracle config file 1075au BufNewFile,BufRead *.ora setf ora 1076 1077" Packet filter conf 1078au BufNewFile,BufRead pf.conf setf pf 1079 1080" Pam conf 1081au BufNewFile,BufRead /etc/pam.conf setf pamconf 1082 1083" PApp 1084au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp 1085 1086" Password file 1087au BufNewFile,BufRead /etc/passwd,/etc/shadow,/etc/shadow- setf passwd 1088 1089" Pascal (also *.p) 1090au BufNewFile,BufRead *.pas setf pascal 1091 1092" Delphi project file 1093au BufNewFile,BufRead *.dpr setf pascal 1094 1095" Perl 1096if has("fname_case") 1097 au BufNewFile,BufRead *.pl,*.PL call s:FTpl() 1098else 1099 au BufNewFile,BufRead *.pl call s:FTpl() 1100endif 1101au BufNewFile,BufRead *.plx setf perl 1102 1103fun! s:FTpl() 1104 if exists("g:filetype_pl") 1105 exe "setf " . g:filetype_pl 1106 else 1107 " recognize Prolog by specific text in the first non-empty line 1108 " require a blank after the '%' because Perl uses "%list" and "%translate" 1109 let l = getline(nextnonblank(1)) 1110 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' 1111 setf prolog 1112 else 1113 setf perl 1114 endif 1115 endif 1116endfun 1117 1118" Perl, XPM or XPM2 1119au BufNewFile,BufRead *.pm 1120 \ if getline(1) =~ "XPM2" | 1121 \ setf xpm2 | 1122 \ elseif getline(1) =~ "XPM" | 1123 \ setf xpm | 1124 \ else | 1125 \ setf perl | 1126 \ endif 1127 1128" Perl POD 1129au BufNewFile,BufRead *.pod setf pod 1130 1131" Php3 1132au BufNewFile,BufRead *.php,*.php3 setf php 1133 1134" Phtml 1135au BufNewFile,BufRead *.phtml setf phtml 1136 1137" Pike 1138au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike 1139 1140" Pinfo config 1141au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo 1142 1143" Palm Resource compiler 1144au BufNewFile,BufRead *.rcp setf pilrc 1145 1146" Pine config 1147au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine 1148 1149" PL/M (also: *.inp) 1150au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm 1151 1152" PL/SQL 1153au BufNewFile,BufRead *.pls,*.plsql setf plsql 1154 1155" PLP 1156au BufNewFile,BufRead *.plp setf plp 1157 1158" PO and PO template (GNU gettext) 1159au BufNewFile,BufRead *.po,*.pot setf po 1160 1161" Postfix main config 1162au BufNewFile,BufRead main.cf setf pfmain 1163 1164" PostScript (+ font files, encapsulated PostScript, Adobe Illustrator) 1165au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr 1166 1167" PostScript Printer Description 1168au BufNewFile,BufRead *.ppd setf ppd 1169 1170" Povray 1171au BufNewFile,BufRead *.pov setf pov 1172 1173" Povray configuration 1174au BufNewFile,BufRead .povrayrc setf povini 1175 1176" Povray, PHP or assembly 1177au BufNewFile,BufRead *.inc call s:FTinc() 1178 1179fun! s:FTinc() 1180 if exists("g:filetype_inc") 1181 exe "setf " . g:filetype_inc 1182 else 1183 let lines = getline(1).getline(2).getline(3) 1184 if lines =~? "perlscript" 1185 setf aspperl 1186 elseif lines =~ "<%" 1187 setf aspvbs 1188 elseif lines =~ "<?" 1189 setf php 1190 else 1191 call s:FTasmsyntax() 1192 if exists("b:asmsyntax") 1193 exe "setf " . b:asmsyntax 1194 else 1195 setf pov 1196 endif 1197 endif 1198 endif 1199endfun 1200 1201" Printcap and Termcap 1202au BufNewFile,BufRead *printcap 1203 \ let b:ptcap_type = "print" | setf ptcap 1204au BufNewFile,BufRead *termcap 1205 \ let b:ptcap_type = "term" | setf ptcap 1206 1207" PCCTS / ANTRL 1208"au BufNewFile,BufRead *.g setf antrl 1209au BufNewFile,BufRead *.g setf pccts 1210 1211" PPWizard 1212au BufNewFile,BufRead *.it,*.ih setf ppwiz 1213 1214" Oracle Pro*C/C++ 1215au BufNewFile,BufRead .pc setf proc 1216 1217" Procmail 1218au BufNewFile,BufRead .procmail,.procmailrc setf procmail 1219 1220" Progress or CWEB 1221au BufNewFile,BufRead *.w call s:FTprogress_cweb() 1222 1223function! s:FTprogress_cweb() 1224 if exists("g:filetype_w") 1225 exe "setf " . g:filetype_w 1226 return 1227 endif 1228 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' 1229 setf progress 1230 else 1231 setf cweb 1232 endif 1233endfun 1234 1235" Progress or assembly 1236au BufNewFile,BufRead *.i call s:FTprogress_asm() 1237 1238function! s:FTprogress_asm() 1239 if exists("g:filetype_i") 1240 exe "setf " . g:filetype_i 1241 return 1242 endif 1243 " This function checks for an assembly comment the first ten lines. 1244 " If not found, assume Progress. 1245 let lnum = 1 1246 while lnum <= 10 && lnum < line('$') 1247 let line = getline(lnum) 1248 if line =~ '^\s*;' || line =~ '^\*' 1249 call s:FTasm() 1250 return 1251 elseif line !~ '^\s*$' || line =~ '^/\*' 1252 " Not an empty line: Doesn't look like valid assembly code. 1253 " Or it looks like a Progress /* comment 1254 break 1255 endif 1256 let lnum = lnum + 1 1257 endw 1258 setf progress 1259endfun 1260 1261" Progress or Pascal 1262au BufNewFile,BufRead *.p call s:FTprogress_pascal() 1263 1264function! s:FTprogress_pascal() 1265 if exists("g:filetype_p") 1266 exe "setf " . g:filetype_p 1267 return 1268 endif 1269 " This function checks for valid Pascal syntax in the first ten lines. 1270 " Look for either an opening comment or a program start. 1271 " If not found, assume Progress. 1272 let lnum = 1 1273 while lnum <= 10 && lnum < line('$') 1274 let line = getline(lnum) 1275 if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' 1276 \ || line =~ '^\s*{' || line =~ '^\s*(\*' 1277 setf pascal 1278 return 1279 elseif line !~ '^\s*$' || line =~ '^/\*' 1280 " Not an empty line: Doesn't look like valid Pascal code. 1281 " Or it looks like a Progress /* comment 1282 break 1283 endif 1284 let lnum = lnum + 1 1285 endw 1286 setf progress 1287endfun 1288 1289 1290" Software Distributor Product Specification File (POSIX 1387.2-1995) 1291au BufNewFile,BufRead *.psf setf psf 1292au BufNewFile,BufRead INDEX,INFO 1293 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' | 1294 \ setf psf | 1295 \ endif 1296 1297" Prolog 1298au BufNewFile,BufRead *.pdb setf prolog 1299 1300" Protocols 1301au BufNewFile,BufRead /etc/protocols setf protocols 1302 1303" Pyrex 1304au BufNewFile,BufRead *.pyx,*.pxd setf pyrex 1305 1306" Python 1307au BufNewFile,BufRead *.py,*.pyw setf python 1308 1309" Radiance 1310au BufNewFile,BufRead *.rad,*.mat setf radiance 1311 1312" Ratpoison config/command files 1313au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison 1314 1315" RCS file 1316au BufNewFile,BufRead *\,v setf rcs 1317 1318" Readline 1319au BufNewFile,BufRead .inputrc,inputrc setf readline 1320 1321" Registry for MS-Windows 1322au BufNewFile,BufRead *.reg 1323 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif 1324 1325" Renderman Interface Bytestream 1326au BufNewFile,BufRead *.rib setf rib 1327 1328" Rexx 1329au BufNewFile,BufRead *.rexx,*.rex setf rexx 1330 1331" R (Splus) 1332au BufNewFile,BufRead *.s,*.S setf r 1333 1334" R Help file 1335au BufNewFile,BufRead *.rd,*.Rd setf rhelp 1336 1337" Rexx, Rebol or R 1338au BufNewFile,BufRead *.r,*.R call s:FTr() 1339 1340fun! s:FTr() 1341 if getline(1) =~ '^REBOL' 1342 setf rebol 1343 else 1344 let n = 1 1345 let max = line("$") 1346 if max > 50 1347 let max = 50 1348 endif 1349 while n < max 1350 " R has # comments 1351 if getline(n) =~ '^\s*#' 1352 setf r 1353 break 1354 endif 1355 " Rexx has /* comments */ 1356 if getline(n) =~ '^\s*/\*' 1357 setf rexx 1358 break 1359 endif 1360 let n = n + 1 1361 endwhile 1362 if n >= max 1363 setf rexx 1364 endif 1365 endif 1366endfun 1367 1368" Remind 1369au BufNewFile,BufRead .reminders* call s:StarSetf('remind') 1370 1371" Resolv.conf 1372au BufNewFile,BufRead resolv.conf setf resolv 1373 1374" Relax NG Compact 1375au BufNewFile,BufRead *.rnc setf rnc 1376 1377" RPL/2 1378au BufNewFile,BufRead *.rpl setf rpl 1379 1380" Robots.txt 1381au BufNewFile,BufRead robots.txt setf robots 1382 1383" Rpcgen 1384au BufNewFile,BufRead *.x setf rpcgen 1385 1386" reStructuredText Documentation Format 1387au BufNewFile,BufRead *.rst setf rst 1388 1389" RTF 1390au BufNewFile,BufRead *.rtf setf rtf 1391 1392" Ruby 1393au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby 1394 1395" Rantfile is like Ruby 1396au BufNewFile,BufRead [rR]antfile,*.rant setf ruby 1397 1398" S-lang (or shader language!) 1399au BufNewFile,BufRead *.sl setf slang 1400 1401" Samba config 1402au BufNewFile,BufRead smb.conf setf samba 1403 1404" SAS script 1405au BufNewFile,BufRead *.sas setf sas 1406 1407" Sather 1408au BufNewFile,BufRead *.sa setf sather 1409 1410" Scilab 1411au BufNewFile,BufRead *.sci,*.sce setf scilab 1412 1413" SDL 1414au BufNewFile,BufRead *.sdl,*.pr setf sdl 1415 1416" sed 1417au BufNewFile,BufRead *.sed setf sed 1418 1419" Sieve (RFC 3028) 1420au BufNewFile,BufRead *.siv setf sieve 1421 1422" Sendmail 1423au BufNewFile,BufRead sendmail.cf setf sm 1424 1425" Sendmail .mc files are actually m4 1426au BufNewFile,BufRead *.mc setf m4 1427 1428" Services 1429au BufNewFile,BufRead /etc/services setf services 1430 1431" Service Location config 1432au BufNewFile,BufRead /etc/slp.conf setf slpconf 1433 1434" Service Location registration 1435au BufNewFile,BufRead /etc/slp.reg setf slpreg 1436 1437" Service Location SPI 1438au BufNewFile,BufRead /etc/slp.spi setf slpspi 1439 1440" Setserial config 1441au BufNewFile,BufRead /etc/serial.conf setf setserial 1442 1443" SGML 1444au BufNewFile,BufRead *.sgm,*.sgml 1445 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' | 1446 \ setf sgmllnx | 1447 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' | 1448 \ let b:docbk_type="sgml" | 1449 \ setf docbk | 1450 \ else | 1451 \ setf sgml | 1452 \ endif 1453 1454" SGMLDECL 1455au BufNewFile,BufRead *.decl,*.dcl,*.dec 1456 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' | 1457 \ setf sgmldecl | 1458 \ endif 1459 1460" SGML catalog file 1461au BufNewFile,BufRead catalog setf catalog 1462au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') 1463 1464" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. 1465" Gentoo ebuilds are actually bash scripts 1466au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash") 1467au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") 1468au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) 1469 1470" Also called from scripts.vim. 1471fun! SetFileTypeSH(name) 1472 if expand("<amatch>") =~ g:ft_ignore_pat 1473 return 1474 endif 1475 if a:name =~ '\<ksh\>' 1476 let b:is_kornshell = 1 1477 if exists("b:is_bash") 1478 unlet b:is_bash 1479 endif 1480 if exists("b:is_sh") 1481 unlet b:is_sh 1482 endif 1483 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' 1484 let b:is_bash = 1 1485 if exists("b:is_kornshell") 1486 unlet b:is_kornshell 1487 endif 1488 if exists("b:is_sh") 1489 unlet b:is_sh 1490 endif 1491 elseif a:name =~ '\<sh\>' 1492 let b:is_sh = 1 1493 if exists("b:is_kornshell") 1494 unlet b:is_kornshell 1495 endif 1496 if exists("b:is_bash") 1497 unlet b:is_bash 1498 endif 1499 endif 1500 call SetFileTypeShell("sh") 1501endfun 1502 1503" For shell-like file types, check for an "exec" command hidden in a comment, 1504" as used for Tcl. 1505" Also called from scripts.vim, thus can't be local to this script. 1506fun! SetFileTypeShell(name) 1507 if expand("<amatch>") =~ g:ft_ignore_pat 1508 return 1509 endif 1510 let l = 2 1511 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' 1512 " Skip empty and comment lines. 1513 let l = l + 1 1514 endwhile 1515 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' 1516 " Found an "exec" line after a comment with continuation 1517 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') 1518 if n =~ '\<tclsh\|\<wish' 1519 setf tcl 1520 return 1521 endif 1522 endif 1523 exe "setf " . a:name 1524endfun 1525 1526" tcsh scripts 1527au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh") 1528 1529" csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) 1530au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH() 1531 1532fun! s:CSH() 1533 if exists("g:filetype_csh") 1534 call SetFileTypeShell(g:filetype_csh) 1535 elseif &shell =~ "tcsh" 1536 call SetFileTypeShell("tcsh") 1537 else 1538 call SetFileTypeShell("csh") 1539 endif 1540endfun 1541 1542" Z-Shell script 1543au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh 1544au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') 1545 1546" Scheme 1547au BufNewFile,BufRead *.scm,*.ss setf scheme 1548 1549" Screen RC 1550au BufNewFile,BufRead .screenrc,screenrc setf screen 1551 1552" Simula 1553au BufNewFile,BufRead *.sim setf simula 1554 1555" SINDA 1556au BufNewFile,BufRead *.sin,*.s85 setf sinda 1557 1558" SiSU 1559au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._ssi setf sisu 1560au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu 1561 1562" SKILL 1563au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill 1564 1565" SLRN 1566au BufNewFile,BufRead .slrnrc setf slrnrc 1567au BufNewFile,BufRead *.score setf slrnsc 1568 1569" Smalltalk (and TeX) 1570au BufNewFile,BufRead *.st setf st 1571au BufNewFile,BufRead *.cls 1572 \ if getline(1) =~ '^%' | 1573 \ setf tex | 1574 \ else | 1575 \ setf st | 1576 \ endif 1577 1578" Smarty templates 1579au BufNewFile,BufRead *.tpl setf smarty 1580 1581" SMIL or XML 1582au BufNewFile,BufRead *.smil 1583 \ if getline(1) =~ '<?\s*xml.*?>' | 1584 \ setf xml | 1585 \ else | 1586 \ setf smil | 1587 \ endif 1588 1589" SMIL or SNMP MIB file 1590au BufNewFile,BufRead *.smi 1591 \ if getline(1) =~ '\<smil\>' | 1592 \ setf smil | 1593 \ else | 1594 \ setf mib | 1595 \ endif 1596 1597" SMITH 1598au BufNewFile,BufRead *.smt,*.smith setf smith 1599 1600" Snobol4 1601au BufNewFile,BufRead *.sno setf snobol4 1602 1603" SNMP MIB files 1604au BufNewFile,BufRead *.mib,*.my setf mib 1605 1606" Snort Configuration 1607au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog 1608 1609" Spec (Linux RPM) 1610au BufNewFile,BufRead *.spec setf spec 1611 1612" Speedup (AspenTech plant simulator) 1613au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup 1614 1615" Slice 1616au BufNewFile,BufRead *.ice setf slice 1617 1618" Spice 1619au BufNewFile,BufRead *.sp,*.spice setf spice 1620 1621" Spyce 1622au BufNewFile,BufRead *.spy,*.spi setf spyce 1623 1624" Squid 1625au BufNewFile,BufRead squid.conf setf squid 1626 1627" SQL for Oracle Designer 1628au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql 1629 1630" SQL 1631au BufNewFile,BufRead *.sql call s:SQL() 1632 1633fun! s:SQL() 1634 if exists("g:filetype_sql") 1635 exe "setf " . g:filetype_sql 1636 else 1637 setf sql 1638 endif 1639endfun 1640 1641" SQLJ 1642au BufNewFile,BufRead *.sqlj setf sqlj 1643 1644" SQR 1645au BufNewFile,BufRead *.sqr,*.sqi setf sqr 1646 1647" OpenSSH configuration 1648au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig 1649 1650" OpenSSH server configuration 1651au BufNewFile,BufRead sshd_config setf sshdconfig 1652 1653" Stored Procedures 1654au BufNewFile,BufRead *.stp setf stp 1655 1656" Standard ML 1657au BufNewFile,BufRead *.sml setf sml 1658 1659" Sysctl 1660au BufNewFile,BufRead /etc/sysctl.conf setf sysctl 1661 1662" Sudoers 1663au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers 1664 1665" If the first line starts with '#' and contains 'perl' it's probably a Perl 1666" file. 1667fun! s:FTperl() 1668 if getline(1)[0] == '#' && getline(1) =~ 'perl' 1669 setf perl 1670 return 1 1671 endif 1672 return 0 1673endfun 1674 1675" Tads (or Nroff or Perl test file) 1676au BufNewFile,BufRead *.t 1677 \ if !s:FTnroff() && !s:FTperl() | setf tads | endif 1678 1679" Tags 1680au BufNewFile,BufRead tags setf tags 1681 1682" TAK 1683au BufNewFile,BufRead *.tak setf tak 1684 1685" Tcl (JACL too) 1686au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl 1687 1688" TealInfo 1689au BufNewFile,BufRead *.tli setf tli 1690 1691" Telix Salt 1692au BufNewFile,BufRead *.slt setf tsalt 1693 1694" Terminfo 1695au BufNewFile,BufRead *.ti setf terminfo 1696 1697" TeX 1698au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex 1699au BufNewFile,BufRead *.tex call s:FTtex() 1700 1701" Choose context, plaintex, or tex (LaTeX) based on these rules: 1702" 1. Check the first line of the file for "%&<format>". 1703" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. 1704" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. 1705fun! s:FTtex() 1706 let firstline = getline(1) 1707 if firstline =~ '^%&\s*\a\+' 1708 let format = tolower(matchstr(firstline, '\a\+')) 1709 let format = substitute(format, 'pdf', '', '') 1710 if format == 'tex' 1711 let format = 'plain' 1712 endif 1713 else 1714 " Default value, may be changed later: 1715 let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' 1716 " Save position, go to the top of the file, find first non-comment line. 1717 let save_cursor = getpos('.') 1718 call cursor(1,1) 1719 let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) 1720 if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. 1721 let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' 1722 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\>' 1723 let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', 1724 \ 'cnp', firstNC + 1000) 1725 if kwline == 1 " lpat matched 1726 let format = 'latex' 1727 elseif kwline == 2 " cpat matched 1728 let format = 'context' 1729 endif " If neither matched, keep default set above. 1730 " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) 1731 " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) 1732 " if cline > 0 1733 " let format = 'context' 1734 " endif 1735 " if lline > 0 && (cline == 0 || cline > lline) 1736 " let format = 'tex' 1737 " endif 1738 endif " firstNC 1739 call setpos('.', save_cursor) 1740 endif " firstline =~ '^%&\s*\a\+' 1741 1742 " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? 1743 if format == 'plain' 1744 setf plaintex 1745 elseif format == 'context' 1746 setf context 1747 else " probably LaTeX 1748 setf tex 1749 endif 1750 return 1751endfun 1752 1753" Context 1754au BufNewFile,BufRead tex/context/*/*.tex setf context 1755 1756" Texinfo 1757au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo 1758 1759" TeX configuration 1760au BufNewFile,BufRead texmf.cnf setf texmf 1761 1762" Tidy config 1763au BufNewFile,BufRead .tidyrc,tidyrc setf tidy 1764 1765" TF mud client 1766au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf 1767 1768" TPP - Text Presentation Program 1769au BufNewFile,BufReadPost *.tpp setf tpp 1770 1771" Trustees 1772au BufNewFile,BufRead trustees.conf setf trustees 1773 1774" TSS - Geometry 1775au BufNewFile,BufReadPost *.tssgm setf tssgm 1776 1777" TSS - Optics 1778au BufNewFile,BufReadPost *.tssop setf tssop 1779 1780" TSS - Command Line (temporary) 1781au BufNewFile,BufReadPost *.tsscl setf tsscl 1782 1783" Motif UIT/UIL files 1784au BufNewFile,BufRead *.uit,*.uil setf uil 1785 1786" Udev conf 1787au BufNewFile,BufRead /etc/udev/udev.conf setf udevconf 1788 1789" Udev rules 1790au BufNewFile,BufRead /etc/udev/rules.d/*.rules setf udevrules 1791 1792" Udev permissions 1793au BufNewFile,BufRead /etc/udev/permissions.d/*.permissions setf udevperm 1794" 1795" Udev symlinks config 1796au BufNewFile,BufRead /etc/udev/cdsymlinks.conf setf sh 1797 1798" UnrealScript 1799au BufNewFile,BufRead *.uc setf uc 1800 1801" Updatedb 1802au BufNewFile,BufRead /etc/updatedb.conf setf updatedb 1803 1804" Verilog HDL 1805au BufNewFile,BufRead *.v setf verilog 1806 1807" Verilog-AMS HDL 1808au BufNewFile,BufRead *.va,*.vams setf verilogams 1809 1810" VHDL 1811au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl 1812au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') 1813 1814" Vim script 1815au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim 1816 1817" Viminfo file 1818au BufNewFile,BufRead .viminfo,_viminfo setf viminfo 1819 1820" Virata Config Script File 1821au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata 1822 1823" Visual Basic (also uses *.bas) or FORM 1824au BufNewFile,BufRead *.frm call s:FTVB("form") 1825 1826" SaxBasic is close to Visual Basic 1827au BufNewFile,BufRead *.sba setf vb 1828 1829" Vgrindefs file 1830au BufNewFile,BufRead vgrindefs setf vgrindefs 1831 1832" VRML V1.0c 1833au BufNewFile,BufRead *.wrl setf vrml 1834 1835" Webmacro 1836au BufNewFile,BufRead *.wm setf webmacro 1837 1838" Wget config 1839au BufNewFile,BufRead .wgetrc,wgetrc setf wget 1840 1841" Website MetaLanguage 1842au BufNewFile,BufRead *.wml setf wml 1843 1844" Winbatch 1845au BufNewFile,BufRead *.wbt setf winbatch 1846 1847" WSML 1848au BufNewFile,BufRead *.wsml setf wsml 1849 1850" WvDial 1851au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial 1852 1853" CVS RC file 1854au BufNewFile,BufRead .cvsrc setf cvsrc 1855 1856" CVS commit file 1857au BufNewFile,BufRead cvs\d\+ setf cvs 1858 1859" WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment 1860" lines in a WEB file). 1861au BufNewFile,BufRead *.web 1862 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" | 1863 \ setf web | 1864 \ else | 1865 \ setf winbatch | 1866 \ endif 1867 1868" Windows Scripting Host and Windows Script Component 1869au BufNewFile,BufRead *.ws[fc] setf wsh 1870 1871" X Pixmap (dynamically sets colors, use BufEnter to make it work better) 1872au BufEnter *.xpm 1873 \ if getline(1) =~ "XPM2" | 1874 \ setf xpm2 | 1875 \ else | 1876 \ setf xpm | 1877 \ endif 1878au BufEnter *.xpm2 setf xpm2 1879 1880" XFree86 config 1881au BufNewFile,BufRead XF86Config 1882 \ if getline(1) =~ '\<XConfigurator\>' | 1883 \ let b:xf86c_xfree86_version = 3 | 1884 \ endif | 1885 \ setf xf86conf 1886 1887" Xorg config 1888au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf 1889 1890" Xinetd conf 1891au BufNewFile,BufRead /etc/xinetd.conf setf xinetd 1892 1893" XS Perl extension interface language 1894au BufNewFile,BufRead *.xs setf xs 1895 1896" X resources file 1897au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults 1898 1899" Xmath 1900au BufNewFile,BufRead *.msc,*.msf setf xmath 1901au BufNewFile,BufRead *.ms 1902 \ if !s:FTnroff() | setf xmath | endif 1903 1904" XML 1905au BufNewFile,BufRead *.xml 1906 \ if getline(1) . getline(2) . getline(3) =~ '<!DOCTYPE.*DocBook' | 1907 \ let b:docbk_type="xml" | 1908 \ setf docbk | 1909 \ else | 1910 \ setf xml | 1911 \ endif 1912 1913" XMI (holding UML models) is also XML 1914au BufNewFile,BufRead *.xmi setf xml 1915 1916" CSPROJ files are Visual Studio.NET's XML-based project config files 1917au BufNewFile,BufRead *.csproj,*.csproj.user setf xml 1918 1919" Qt Linguist translation source and Qt User Interface Files are XML 1920au BufNewFile,BufRead *.ts,*.ui setf xml 1921 1922" Xdg menus 1923au BufNewFile,BufRead /etc/xdg/menus/*.menu setf xml 1924 1925" Xquery 1926au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy setf xquery 1927 1928" XSD 1929au BufNewFile,BufRead *.xsd setf xsd 1930 1931" Xslt 1932au BufNewFile,BufRead *.xsl,*.xslt setf xslt 1933 1934" Yacc 1935au BufNewFile,BufRead *.yy setf yacc 1936 1937" Yacc or racc 1938au BufNewFile,BufRead *.y call s:FTy() 1939 1940fun! s:FTy() 1941 let n = 1 1942 while n < 100 && n < line("$") 1943 let line = getline(n) 1944 if line =~ '^\s*%' 1945 setf yacc 1946 return 1947 endif 1948 if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' 1949 setf racc 1950 return 1951 endif 1952 let n = n + 1 1953 endwhile 1954 setf yacc 1955endfun 1956 1957 1958" Yaml 1959au BufNewFile,BufRead *.yaml,*.yml setf yaml 1960 1961" Zope 1962" dtml (zope dynamic template markup language), pt (zope page template), 1963" cpt (zope form controller page template) 1964au BufNewFile,BufRead *.dtml,*.pt,*.cpt call <SID>FTCheck_html() 1965" zsql (zope sql method) 1966au BufNewFile,BufRead *.zsql call s:SQL() 1967 1968" Z80 assembler asz80 1969au BufNewFile,BufRead *.z8a setf z8a 1970 1971augroup END 1972 1973 1974" Source the user-specified filetype file, for backwards compatibility with 1975" Vim 5.x. 1976if exists("myfiletypefile") && filereadable(expand(myfiletypefile)) 1977 execute "source " . myfiletypefile 1978endif 1979 1980 1981" Check for "*" after loading myfiletypefile, so that scripts.vim is only used 1982" when there are no matching file name extensions. 1983" Don't do this for compressed files. 1984augroup filetypedetect 1985au BufNewFile,BufRead * 1986 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat 1987 \ | runtime! scripts.vim | endif 1988au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif 1989 1990 1991" Extra checks for when no filetype has been detected now. Mostly used for 1992" patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim 1993" script file. 1994" Most of these should call s:StarSetf() to avoid names ending in .gz and the 1995" like are used. 1996 1997" Asterisk config file 1998au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') 1999au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') 2000 2001" BIND zone 2002au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') 2003 2004" Changelog 2005au BufNewFile,BufRead [cC]hange[lL]og* 2006 \ if getline(1) =~ '; urgency=' 2007 \| call s:StarSetf('debchangelog') 2008 \|else 2009 \| call s:StarSetf('changelog') 2010 \|endif 2011 2012" Crontab 2013au BufNewFile,BufRead crontab,crontab.* call s:StarSetf('crontab') 2014 2015" Debian Sources.list 2016au BufNewFile,BufRead /etc/apt/sources.list.d/* call s:StarSetf('debsources') 2017 2018" Dracula 2019au BufNewFile,BufRead drac.* call s:StarSetf('dracula') 2020 2021" Fvwm 2022au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook 2023 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm') 2024au BufNewFile,BufRead *fvwm2rc* 2025 \ if expand("<afile>:e") == "m4" 2026 \| call s:StarSetf('fvwm2m4') 2027 \|else 2028 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm') 2029 \|endif 2030 2031" GTK RC 2032au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') 2033 2034" Jam 2035au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam') 2036 2037" Jargon 2038au! BufNewFile,BufRead *jarg* 2039 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE' 2040 \| call s:StarSetf('jargon') 2041 \|endif 2042 2043" Makefile 2044au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') 2045 2046" Modconf 2047au BufNewFile,BufRead /etc/modprobe.* call s:StarSetf('modconf') 2048 2049" Ruby Makefile 2050au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') 2051 2052" Mutt setup file 2053au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') 2054 2055" Nroff macros 2056au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') 2057 2058" Pam conf 2059au BufNewFile,BufRead /etc/pam.d/* call s:StarSetf('pamconf') 2060 2061" Printcap and Termcap 2062au BufNewFile,BufRead *printcap* 2063 \ if !did_filetype() 2064 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap') 2065 \|endif 2066au BufNewFile,BufRead *termcap* 2067 \ if !did_filetype() 2068 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap') 2069 \|endif 2070 2071" Vim script 2072au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') 2073 2074" Subversion commit file 2075au BufNewFile,BufRead svn-commit*.tmp setf svn 2076 2077" X resources file 2078au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults') 2079 2080" XFree86 config 2081au BufNewFile,BufRead XF86Config-4* 2082 \ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf') 2083au BufNewFile,BufRead XF86Config* 2084 \ if getline(1) =~ '\<XConfigurator\>' 2085 \| let b:xf86c_xfree86_version = 3 2086 \|endif 2087 \|call s:StarSetf('xf86conf') 2088 2089" X11 xmodmap 2090au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') 2091 2092" Xinetd conf 2093au BufNewFile,BufRead /etc/xinetd.d/* call s:StarSetf('xinetd') 2094 2095" Z-Shell script 2096au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') 2097 2098 2099" Generic configuration file (check this last, it's just guessing!) 2100au BufNewFile,BufRead,StdinReadPost * 2101 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat 2102 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#' 2103 \ || getline(4) =~ '^#' || getline(5) =~ '^#') | 2104 \ setf conf | 2105 \ endif 2106 2107" Use the plugin-filetype checks last, they may overrule any of the previously 2108" detected filetypes. 2109runtime! ftdetect/*.vim 2110 2111augroup END 2112 2113 2114" If the GUI is already running, may still need to install the Syntax menu. 2115" Don't do it when the 'M' flag is included in 'guioptions'. 2116if has("menu") && has("gui_running") 2117 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M" 2118 source <sfile>:p:h/menu.vim 2119endif 2120 2121" Restore 'cpoptions' 2122let &cpo = s:cpo_save 2123unlet s:cpo_save 2124