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