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