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