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