xref: /vim-8.2.3635/runtime/filetype.vim (revision c8cdf0f8)
1" Vim support file to detect file types
2"
3" Maintainer:	Bram Moolenaar <[email protected]>
4" Last Change:	2021 Mar 12
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" Poke
1338au BufNewFile,BufRead *.pk      		setf poke
1339
1340" Protocols
1341au BufNewFile,BufRead */etc/protocols		setf protocols
1342
1343" Pyrex
1344au BufNewFile,BufRead *.pyx,*.pxd		setf pyrex
1345
1346" Python, Python Shell Startup and Python Stub Files
1347" Quixote (Python-based web framework)
1348au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc  setf python
1349au BufNewFile,BufRead *.ptl,*.pyi,SConstruct		   setf python
1350
1351" Radiance
1352au BufNewFile,BufRead *.rad,*.mat		setf radiance
1353
1354" Ratpoison config/command files
1355au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc	setf ratpoison
1356
1357" RCS file
1358au BufNewFile,BufRead *\,v			setf rcs
1359
1360" Readline
1361au BufNewFile,BufRead .inputrc,inputrc		setf readline
1362
1363" Registry for MS-Windows
1364au BufNewFile,BufRead *.reg
1365	\ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
1366
1367" Renderman Interface Bytestream
1368au BufNewFile,BufRead *.rib			setf rib
1369
1370" Rego Policy Language
1371au BufNewFile,BufRead *.rego			setf rego
1372
1373" Rexx
1374au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit	setf rexx
1375
1376" R Help file
1377if has("fname_case")
1378  au BufNewFile,BufRead *.rd,*.Rd		setf rhelp
1379else
1380  au BufNewFile,BufRead *.rd			setf rhelp
1381endif
1382
1383" R noweb file
1384if has("fname_case")
1385  au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw		setf rnoweb
1386else
1387  au BufNewFile,BufRead *.rnw,*.snw			setf rnoweb
1388endif
1389
1390" R Markdown file
1391if has("fname_case")
1392  au BufNewFile,BufRead *.Rmd,*.rmd,*.Smd,*.smd		setf rmd
1393else
1394  au BufNewFile,BufRead *.rmd,*.smd			setf rmd
1395endif
1396
1397" R reStructuredText file
1398if has("fname_case")
1399  au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst	setf rrst
1400else
1401  au BufNewFile,BufRead *.rrst,*.srst			setf rrst
1402endif
1403
1404" Rexx, Rebol or R
1405au BufNewFile,BufRead *.r,*.R				call dist#ft#FTr()
1406
1407" Remind
1408au BufNewFile,BufRead .reminders,*.remind,*.rem		setf remind
1409
1410" Resolv.conf
1411au BufNewFile,BufRead resolv.conf		setf resolv
1412
1413" Relax NG Compact
1414au BufNewFile,BufRead *.rnc			setf rnc
1415
1416" Relax NG XML
1417au BufNewFile,BufRead *.rng			setf rng
1418
1419" RPL/2
1420au BufNewFile,BufRead *.rpl			setf rpl
1421
1422" Robots.txt
1423au BufNewFile,BufRead robots.txt		setf robots
1424
1425" Rpcgen
1426au BufNewFile,BufRead *.x			setf rpcgen
1427
1428" reStructuredText Documentation Format
1429au BufNewFile,BufRead *.rst			setf rst
1430
1431" RTF
1432au BufNewFile,BufRead *.rtf			setf rtf
1433
1434" Interactive Ruby shell
1435au BufNewFile,BufRead .irbrc,irbrc		setf ruby
1436
1437" Ruby
1438au BufNewFile,BufRead *.rb,*.rbw		setf ruby
1439
1440" RubyGems
1441au BufNewFile,BufRead *.gemspec			setf ruby
1442
1443" RBS (Ruby Signature)
1444au BufNewFile,BufRead *.rbs			setf rbs
1445
1446" Rackup
1447au BufNewFile,BufRead *.ru			setf ruby
1448
1449" Bundler
1450au BufNewFile,BufRead Gemfile			setf ruby
1451
1452" Ruby on Rails
1453au BufNewFile,BufRead *.builder,*.rxml,*.rjs	setf ruby
1454
1455" Rantfile and Rakefile is like Ruby
1456au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake	setf ruby
1457
1458" Rust
1459au BufNewFile,BufRead *.rs			setf rust
1460
1461" S-lang (or shader language, or SmallLisp)
1462au BufNewFile,BufRead *.sl			setf slang
1463
1464" Samba config
1465au BufNewFile,BufRead smb.conf			setf samba
1466
1467" SAS script
1468au BufNewFile,BufRead *.sas			setf sas
1469
1470" Sass
1471au BufNewFile,BufRead *.sass			setf sass
1472
1473" Sather
1474au BufNewFile,BufRead *.sa			setf sather
1475
1476" Scala
1477au BufNewFile,BufRead *.scala			setf scala
1478
1479" SBT - Scala Build Tool
1480au BufNewFile,BufRead *.sbt			setf sbt
1481
1482" Scilab
1483au BufNewFile,BufRead *.sci,*.sce		setf scilab
1484
1485" SCSS
1486au BufNewFile,BufRead *.scss			setf scss
1487
1488" SD: Streaming Descriptors
1489au BufNewFile,BufRead *.sd			setf sd
1490
1491" SDL
1492au BufNewFile,BufRead *.sdl,*.pr		setf sdl
1493
1494" sed
1495au BufNewFile,BufRead *.sed			setf sed
1496
1497" svelte
1498au BufNewFile,BufRead *.svelte			setf svelte
1499
1500" Sieve (RFC 3028, 5228)
1501au BufNewFile,BufRead *.siv,*.sieve		setf sieve
1502
1503" Sendmail
1504au BufNewFile,BufRead sendmail.cf		setf sm
1505
1506" Sendmail .mc files are actually m4.  Could also be MS Message text file.
1507au BufNewFile,BufRead *.mc			call dist#ft#McSetf()
1508
1509" Services
1510au BufNewFile,BufRead */etc/services		setf services
1511
1512" Service Location config
1513au BufNewFile,BufRead */etc/slp.conf		setf slpconf
1514
1515" Service Location registration
1516au BufNewFile,BufRead */etc/slp.reg		setf slpreg
1517
1518" Service Location SPI
1519au BufNewFile,BufRead */etc/slp.spi		setf slpspi
1520
1521" Setserial config
1522au BufNewFile,BufRead */etc/serial.conf		setf setserial
1523
1524" SGML
1525au BufNewFile,BufRead *.sgm,*.sgml
1526	\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
1527	\   setf sgmllnx |
1528	\ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
1529	\   let b:docbk_type = "sgml" |
1530	\   let b:docbk_ver = 4 |
1531	\   setf docbk |
1532	\ else |
1533	\   setf sgml |
1534	\ endif
1535
1536" SGMLDECL
1537au BufNewFile,BufRead *.decl,*.dcl,*.dec
1538	\ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
1539	\    setf sgmldecl |
1540	\ endif
1541
1542" SGML catalog file
1543au BufNewFile,BufRead catalog			setf catalog
1544
1545" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
1546" Gentoo ebuilds, Arch Linux PKGBUILDs and Alpine Linux APKBUILDs are actually
1547" bash scripts.
1548" NOTE: Patterns ending in a star are further down, these have lower priority.
1549au 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")
1550au BufNewFile,BufRead .kshrc,*.ksh call dist#ft#SetFileTypeSH("ksh")
1551au BufNewFile,BufRead */etc/profile,.profile,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1))
1552
1553
1554" Shell script (Arch Linux) or PHP file (Drupal)
1555au BufNewFile,BufRead *.install
1556	\ if getline(1) =~ '<?php' |
1557	\   setf php |
1558	\ else |
1559	\   call dist#ft#SetFileTypeSH("bash") |
1560	\ endif
1561
1562" tcsh scripts (patterns ending in a star further below)
1563au BufNewFile,BufRead .tcshrc,*.tcsh,tcsh.tcshrc,tcsh.login	call dist#ft#SetFileTypeShell("tcsh")
1564
1565" csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
1566" (patterns ending in a start further below)
1567au BufNewFile,BufRead .login,.cshrc,csh.cshrc,csh.login,csh.logout,*.csh,.alias  call dist#ft#CSH()
1568
1569" Z-Shell script (patterns ending in a star further below)
1570au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks  setf zsh
1571au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump setf zsh
1572au BufNewFile,BufRead *.zsh			setf zsh
1573
1574" Scheme
1575au BufNewFile,BufRead *.scm,*.ss,*.rkt		setf scheme
1576
1577" Screen RC
1578au BufNewFile,BufRead .screenrc,screenrc	setf screen
1579
1580" Sexplib
1581au BufNewFile,BufRead *.sexp setf sexplib
1582
1583" Simula
1584au BufNewFile,BufRead *.sim			setf simula
1585
1586" SINDA
1587au BufNewFile,BufRead *.sin,*.s85		setf sinda
1588
1589" SiSU
1590au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisu
1591au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu
1592
1593" SKILL
1594au BufNewFile,BufRead *.il,*.ils,*.cdf		setf skill
1595
1596" SLRN
1597au BufNewFile,BufRead .slrnrc			setf slrnrc
1598au BufNewFile,BufRead *.score			setf slrnsc
1599
1600" Smalltalk (and TeX)
1601au BufNewFile,BufRead *.st			setf st
1602au BufNewFile,BufRead *.cls
1603	\ if getline(1) =~ '^%' |
1604	\  setf tex |
1605	\ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' |
1606	\  setf rexx |
1607	\ else |
1608	\  setf st |
1609	\ endif
1610
1611" Smarty templates
1612au BufNewFile,BufRead *.tpl			setf smarty
1613
1614" SMIL or XML
1615au BufNewFile,BufRead *.smil
1616	\ if getline(1) =~ '<?\s*xml.*?>' |
1617	\   setf xml |
1618	\ else |
1619	\   setf smil |
1620	\ endif
1621
1622" SMIL or SNMP MIB file
1623au BufNewFile,BufRead *.smi
1624	\ if getline(1) =~ '\<smil\>' |
1625	\   setf smil |
1626	\ else |
1627	\   setf mib |
1628	\ endif
1629
1630" SMITH
1631au BufNewFile,BufRead *.smt,*.smith		setf smith
1632
1633" Snobol4 and spitbol
1634au BufNewFile,BufRead *.sno,*.spt		setf snobol4
1635
1636" SNMP MIB files
1637au BufNewFile,BufRead *.mib,*.my		setf mib
1638
1639" Snort Configuration
1640au BufNewFile,BufRead *.hog,snort.conf,vision.conf	setf hog
1641au BufNewFile,BufRead *.rules			call dist#ft#FTRules()
1642
1643" SPARQL queries
1644au BufNewFile,BufRead *.rq,*.sparql		setf sparql
1645
1646" Spec (Linux RPM)
1647au BufNewFile,BufRead *.spec			setf spec
1648
1649" Speedup (AspenTech plant simulator)
1650au BufNewFile,BufRead *.speedup,*.spdata,*.spd	setf spup
1651
1652" Slice
1653au BufNewFile,BufRead *.ice			setf slice
1654
1655" Spice
1656au BufNewFile,BufRead *.sp,*.spice		setf spice
1657
1658" Spyce
1659au BufNewFile,BufRead *.spy,*.spi		setf spyce
1660
1661" Squid
1662au BufNewFile,BufRead squid.conf		setf squid
1663
1664" SQL for Oracle Designer
1665au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks	setf sql
1666
1667" SQL
1668au BufNewFile,BufRead *.sql			call dist#ft#SQL()
1669
1670" SQLJ
1671au BufNewFile,BufRead *.sqlj			setf sqlj
1672
1673" SQR
1674au BufNewFile,BufRead *.sqr,*.sqi		setf sqr
1675
1676" OpenSSH configuration
1677au BufNewFile,BufRead ssh_config,*/.ssh/config		setf sshconfig
1678au BufNewFile,BufRead */etc/ssh/ssh_config.d/*.conf	setf sshconfig
1679
1680" OpenSSH server configuration
1681au BufNewFile,BufRead sshd_config			setf sshdconfig
1682au BufNewFile,BufRead */etc/ssh/sshd_config.d/*.conf	setf sshdconfig
1683
1684" Stata
1685au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata	setf stata
1686" Also *.class, but not when it's a Java bytecode file
1687au BufNewFile,BufRead *.class
1688	\ if getline(1) !~ "^\xca\xfe\xba\xbe" | setf stata | endif
1689
1690" SMCL
1691au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl	setf smcl
1692
1693" Stored Procedures
1694au BufNewFile,BufRead *.stp			setf stp
1695
1696" Standard ML
1697au BufNewFile,BufRead *.sml			setf sml
1698
1699" Sratus VOS command macro
1700au BufNewFile,BufRead *.cm			setf voscm
1701
1702" Swift
1703au BufNewFile,BufRead *.swift			setf swift
1704au BufNewFile,BufRead *.swift.gyb		setf swiftgyb
1705
1706" Swift Intermediate Language
1707au BufNewFile,BufRead *.sil			setf sil
1708
1709" Sysctl
1710au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf	setf sysctl
1711
1712" Systemd unit files
1713au BufNewFile,BufRead */systemd/*.{automount,dnssd,link,mount,netdev,network,nspawn,path,service,slice,socket,swap,target,timer}	setf systemd
1714" Systemd overrides
1715au BufNewFile,BufRead */etc/systemd/*.conf.d/*.conf	setf systemd
1716au BufNewFile,BufRead */etc/systemd/system/*.d/*.conf	setf systemd
1717au BufNewFile,BufRead */.config/systemd/user/*.d/*.conf	setf systemd
1718" Systemd temp files
1719au BufNewFile,BufRead */etc/systemd/system/*.d/.#*	setf systemd
1720au BufNewFile,BufRead */etc/systemd/system/.#*		setf systemd
1721au BufNewFile,BufRead */.config/systemd/user/*.d/.#*	setf systemd
1722au BufNewFile,BufRead */.config/systemd/user/.#*	setf systemd
1723
1724" Synopsys Design Constraints
1725au BufNewFile,BufRead *.sdc			setf sdc
1726
1727" Sudoers
1728au BufNewFile,BufRead */etc/sudoers,sudoers.tmp	setf sudoers
1729
1730" SVG (Scalable Vector Graphics)
1731au BufNewFile,BufRead *.svg			setf svg
1732
1733" Tads (or Nroff or Perl test file)
1734au BufNewFile,BufRead *.t
1735	\ if !dist#ft#FTnroff() && !dist#ft#FTperl() | setf tads | endif
1736
1737" Tags
1738au BufNewFile,BufRead tags			setf tags
1739
1740" TAK
1741au BufNewFile,BufRead *.tak			setf tak
1742
1743" Task
1744au BufRead,BufNewFile {pending,completed,undo}.data  setf taskdata
1745au BufRead,BufNewFile *.task			setf taskedit
1746
1747" Tcl (JACL too)
1748au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl	setf tcl
1749
1750" TealInfo
1751au BufNewFile,BufRead *.tli			setf tli
1752
1753" Telix Salt
1754au BufNewFile,BufRead *.slt			setf tsalt
1755
1756" Tera Term Language or Turtle
1757au BufRead,BufNewFile *.ttl
1758	\ if getline(1) =~ '^@\?\(prefix\|base\)' |
1759	\   setf turtle |
1760	\ else |
1761	\   setf teraterm |
1762	\ endif
1763
1764" Terminfo
1765au BufNewFile,BufRead *.ti			setf terminfo
1766
1767" TeX
1768au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl	setf tex
1769au BufNewFile,BufRead *.tex			call dist#ft#FTtex()
1770
1771" ConTeXt
1772au BufNewFile,BufRead *.mkii,*.mkiv,*.mkvi,*.mkxl,*.mklx   setf context
1773
1774" Texinfo
1775au BufNewFile,BufRead *.texinfo,*.texi,*.txi	setf texinfo
1776
1777" TeX configuration
1778au BufNewFile,BufRead texmf.cnf			setf texmf
1779
1780" Tidy config
1781au BufNewFile,BufRead .tidyrc,tidyrc,tidy.conf	setf tidy
1782
1783" TF mud client
1784au BufNewFile,BufRead *.tf,.tfrc,tfrc		setf tf
1785
1786" tmux configuration
1787au BufNewFile,BufRead {.,}tmux*.conf		setf tmux
1788
1789" TOML
1790au BufNewFile,BufRead *.toml			setf toml
1791
1792" TPP - Text Presentation Program
1793au BufNewFile,BufReadPost *.tpp			setf tpp
1794
1795" Treetop
1796au BufRead,BufNewFile *.treetop			setf treetop
1797
1798" Trustees
1799au BufNewFile,BufRead trustees.conf		setf trustees
1800
1801" TSS - Geometry
1802au BufNewFile,BufReadPost *.tssgm		setf tssgm
1803
1804" TSS - Optics
1805au BufNewFile,BufReadPost *.tssop		setf tssop
1806
1807" TSS - Command Line (temporary)
1808au BufNewFile,BufReadPost *.tsscl		setf tsscl
1809
1810" TWIG files
1811au BufNewFile,BufReadPost *.twig		setf twig
1812
1813" Typescript or Qt translation file (which is XML)
1814au BufNewFile,BufReadPost *.ts
1815	\ if getline(1) =~ '<?xml' |
1816	\   setf xml |
1817	\ else |
1818	\   setf typescript |
1819	\ endif
1820
1821" TypeScript with React
1822au BufNewFile,BufRead *.tsx			setf typescriptreact
1823
1824" Motif UIT/UIL files
1825au BufNewFile,BufRead *.uit,*.uil		setf uil
1826
1827" Udev conf
1828au BufNewFile,BufRead */etc/udev/udev.conf	setf udevconf
1829
1830" Udev permissions
1831au BufNewFile,BufRead */etc/udev/permissions.d/*.permissions setf udevperm
1832"
1833" Udev symlinks config
1834au BufNewFile,BufRead */etc/udev/cdsymlinks.conf	setf sh
1835
1836" UnrealScript
1837au BufNewFile,BufRead *.uc			setf uc
1838
1839" Updatedb
1840au BufNewFile,BufRead */etc/updatedb.conf	setf updatedb
1841
1842" Upstart (init(8)) config files
1843au BufNewFile,BufRead */usr/share/upstart/*.conf	       setf upstart
1844au BufNewFile,BufRead */usr/share/upstart/*.override	       setf upstart
1845au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override  setf upstart
1846au BufNewFile,BufRead */.init/*.conf,*/.init/*.override	       setf upstart
1847au BufNewFile,BufRead */.config/upstart/*.conf		       setf upstart
1848au BufNewFile,BufRead */.config/upstart/*.override	       setf upstart
1849
1850" Vera
1851au BufNewFile,BufRead *.vr,*.vri,*.vrh		setf vera
1852
1853" Verilog HDL
1854au BufNewFile,BufRead *.v			setf verilog
1855
1856" Verilog-AMS HDL
1857au BufNewFile,BufRead *.va,*.vams		setf verilogams
1858
1859" SystemVerilog
1860au BufNewFile,BufRead *.sv,*.svh		setf systemverilog
1861
1862" VHDL
1863au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst,*.vho  setf vhdl
1864
1865" Vim script
1866au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc	setf vim
1867
1868" Viminfo file
1869au BufNewFile,BufRead .viminfo,_viminfo		setf viminfo
1870
1871" Virata Config Script File or Drupal module
1872au BufRead,BufNewFile *.hw,*.module,*.pkg
1873	\ if getline(1) =~ '<?php' |
1874	\   setf php |
1875	\ else |
1876	\   setf virata |
1877	\ endif
1878
1879" Visual Basic (also uses *.bas) or FORM
1880au BufNewFile,BufRead *.frm			call dist#ft#FTVB("form")
1881
1882" SaxBasic is close to Visual Basic
1883au BufNewFile,BufRead *.sba			setf vb
1884
1885" Vgrindefs file
1886au BufNewFile,BufRead vgrindefs			setf vgrindefs
1887
1888" VRML V1.0c
1889au BufNewFile,BufRead *.wrl			setf vrml
1890
1891" Vroom (vim testing and executable documentation)
1892au BufNewFile,BufRead *.vroom			setf vroom
1893
1894" Vue.js Single File Component
1895au BufNewFile,BufRead *.vue			setf vue
1896
1897" WebAssembly
1898au BufNewFile,BufRead *.wast,*.wat		setf wast
1899
1900" Webmacro
1901au BufNewFile,BufRead *.wm			setf webmacro
1902
1903" Wget config
1904au BufNewFile,BufRead .wgetrc,wgetrc		setf wget
1905
1906" Website MetaLanguage
1907au BufNewFile,BufRead *.wml			setf wml
1908
1909" Winbatch
1910au BufNewFile,BufRead *.wbt			setf winbatch
1911
1912" WSML
1913au BufNewFile,BufRead *.wsml			setf wsml
1914
1915" WPL
1916au BufNewFile,BufRead *.wpl			setf xml
1917
1918" WvDial
1919au BufNewFile,BufRead wvdial.conf,.wvdialrc	setf wvdial
1920
1921" CVS RC file
1922au BufNewFile,BufRead .cvsrc			setf cvsrc
1923
1924" CVS commit file
1925au BufNewFile,BufRead cvs\d\+			setf cvs
1926
1927" WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
1928" lines in a WEB file).
1929au BufNewFile,BufRead *.web
1930	\ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
1931	\   setf web |
1932	\ else |
1933	\   setf winbatch |
1934	\ endif
1935
1936" Windows Scripting Host and Windows Script Component
1937au BufNewFile,BufRead *.ws[fc]			setf wsh
1938
1939" XHTML
1940au BufNewFile,BufRead *.xhtml,*.xht		setf xhtml
1941
1942" X Pixmap (dynamically sets colors, use BufEnter to make it work better)
1943au BufEnter *.xpm
1944	\ if getline(1) =~ "XPM2" |
1945	\   setf xpm2 |
1946	\ else |
1947	\   setf xpm |
1948	\ endif
1949au BufEnter *.xpm2				setf xpm2
1950
1951" XFree86 config
1952au BufNewFile,BufRead XF86Config
1953	\ if getline(1) =~ '\<XConfigurator\>' |
1954	\   let b:xf86conf_xfree86_version = 3 |
1955	\ endif |
1956	\ setf xf86conf
1957au BufNewFile,BufRead */xorg.conf.d/*.conf
1958	\ let b:xf86conf_xfree86_version = 4 |
1959	\ setf xf86conf
1960
1961" Xorg config
1962au BufNewFile,BufRead xorg.conf,xorg.conf-4	let b:xf86conf_xfree86_version = 4 | setf xf86conf
1963
1964" Xinetd conf
1965au BufNewFile,BufRead */etc/xinetd.conf		setf xinetd
1966
1967" XS Perl extension interface language
1968au BufNewFile,BufRead *.xs			setf xs
1969
1970" X resources file
1971au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
1972
1973" Xmath
1974au BufNewFile,BufRead *.msc,*.msf		setf xmath
1975au BufNewFile,BufRead *.ms
1976	\ if !dist#ft#FTnroff() | setf xmath | endif
1977
1978" XML  specific variants: docbk and xbl
1979au BufNewFile,BufRead *.xml			call dist#ft#FTxml()
1980
1981" XMI (holding UML models) is also XML
1982au BufNewFile,BufRead *.xmi			setf xml
1983
1984" CSPROJ files are Visual Studio.NET's XML-based project config files
1985au BufNewFile,BufRead *.csproj,*.csproj.user	setf xml
1986
1987" Qt Linguist translation source and Qt User Interface Files are XML
1988" However, for .ts Typescript is more common.
1989au BufNewFile,BufRead *.ui			setf xml
1990
1991" TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)
1992au BufNewFile,BufRead *.tpm			setf xml
1993
1994" Xdg menus
1995au BufNewFile,BufRead */etc/xdg/menus/*.menu	setf xml
1996
1997" ATI graphics driver configuration
1998au BufNewFile,BufRead fglrxrc			setf xml
1999
2000" Web Services Description Language (WSDL)
2001au BufNewFile,BufRead *.wsdl			setf xml
2002
2003" XLIFF (XML Localisation Interchange File Format) is also XML
2004au BufNewFile,BufRead *.xlf			setf xml
2005au BufNewFile,BufRead *.xliff			setf xml
2006
2007" XML User Interface Language
2008au BufNewFile,BufRead *.xul			setf xml
2009
2010" X11 xmodmap (also see below)
2011au BufNewFile,BufRead *Xmodmap			setf xmodmap
2012
2013" Xquery
2014au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy	setf xquery
2015
2016" XSD
2017au BufNewFile,BufRead *.xsd			setf xsd
2018
2019" Xslt
2020au BufNewFile,BufRead *.xsl,*.xslt		setf xslt
2021
2022" Yacc
2023au BufNewFile,BufRead *.yy,*.yxx,*.y++		setf yacc
2024
2025" Yacc or racc
2026au BufNewFile,BufRead *.y			call dist#ft#FTy()
2027
2028" Yaml
2029au BufNewFile,BufRead *.yaml,*.yml		setf yaml
2030
2031" Raml
2032au BufNewFile,BufRead *.raml			setf raml
2033
2034" yum conf (close enough to dosini)
2035au BufNewFile,BufRead */etc/yum.conf		setf dosini
2036
2037" Zimbu
2038au BufNewFile,BufRead *.zu			setf zimbu
2039" Zimbu Templates
2040au BufNewFile,BufRead *.zut			setf zimbutempl
2041
2042" Zope
2043"   dtml (zope dynamic template markup language), pt (zope page template),
2044"   cpt (zope form controller page template)
2045au BufNewFile,BufRead *.dtml,*.pt,*.cpt		call dist#ft#FThtml()
2046"   zsql (zope sql method)
2047au BufNewFile,BufRead *.zsql			call dist#ft#SQL()
2048
2049" Z80 assembler asz80
2050au BufNewFile,BufRead *.z8a			setf z8a
2051
2052augroup END
2053
2054
2055" Source the user-specified filetype file, for backwards compatibility with
2056" Vim 5.x.
2057if exists("myfiletypefile") && filereadable(expand(myfiletypefile))
2058  execute "source " . myfiletypefile
2059endif
2060
2061
2062" Check for "*" after loading myfiletypefile, so that scripts.vim is only used
2063" when there are no matching file name extensions.
2064" Don't do this for compressed files.
2065augroup filetypedetect
2066au BufNewFile,BufRead *
2067	\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
2068	\ | runtime! scripts.vim | endif
2069au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
2070
2071
2072" Extra checks for when no filetype has been detected now.  Mostly used for
2073" patterns that end in "*".  E.g., "zsh*" matches "zsh.vim", but that's a Vim
2074" script file.
2075" Most of these should call s:StarSetf() to avoid names ending in .gz and the
2076" like are used.
2077
2078" More Apache style config files
2079au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/*	call s:StarSetf('apachestyle')
2080au BufNewFile,BufRead proftpd.conf*					call s:StarSetf('apachestyle')
2081
2082" More Apache config files
2083au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf*	call s:StarSetf('apache')
2084au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf*		call s:StarSetf('apache')
2085
2086" Asterisk config file
2087au BufNewFile,BufRead *asterisk/*.conf*		call s:StarSetf('asterisk')
2088au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm')
2089
2090" Bazaar version control
2091au BufNewFile,BufRead bzr_log.*			setf bzr
2092
2093" Bazel build file
2094if !has("fname_case")
2095  au BufNewFile,BufRead *.BUILD,BUILD		setf bzl
2096endif
2097
2098" BIND zone
2099au BufNewFile,BufRead */named/db.*,*/bind/db.*	call s:StarSetf('bindzone')
2100
2101au BufNewFile,BufRead cabal.project.*		call s:StarSetf('cabalproject')
2102
2103" Calendar
2104au BufNewFile,BufRead */.calendar/*,
2105	\*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
2106	\					call s:StarSetf('calendar')
2107
2108" Changelog
2109au BufNewFile,BufRead [cC]hange[lL]og*
2110	\ if getline(1) =~ '; urgency='
2111	\|  call s:StarSetf('debchangelog')
2112	\|else
2113	\|  call s:StarSetf('changelog')
2114	\|endif
2115
2116" Crontab
2117au BufNewFile,BufRead crontab,crontab.*,*/etc/cron.d/*		call s:StarSetf('crontab')
2118
2119" dnsmasq(8) configuration
2120au BufNewFile,BufRead */etc/dnsmasq.d/*		call s:StarSetf('dnsmasq')
2121
2122" Dracula
2123au BufNewFile,BufRead drac.*			call s:StarSetf('dracula')
2124
2125" Fvwm
2126au BufNewFile,BufRead */.fvwm/*			call s:StarSetf('fvwm')
2127au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
2128	\ let b:fvwm_version = 1 | call s:StarSetf('fvwm')
2129au BufNewFile,BufRead *fvwm2rc*
2130	\ if expand("<afile>:e") == "m4"
2131	\|  call s:StarSetf('fvwm2m4')
2132	\|else
2133	\|  let b:fvwm_version = 2 | call s:StarSetf('fvwm')
2134	\|endif
2135
2136" Gedcom
2137au BufNewFile,BufRead */tmp/lltmp*		call s:StarSetf('gedcom')
2138
2139" Git
2140au BufNewFile,BufRead */.gitconfig.d/*,/etc/gitconfig.d/*	call s:StarSetf('gitconfig')
2141
2142" Gitolite
2143au BufNewFile,BufRead */gitolite-admin/conf/*	call s:StarSetf('gitolite')
2144
2145" GTK RC
2146au BufNewFile,BufRead .gtkrc*,gtkrc*		call s:StarSetf('gtkrc')
2147
2148" Jam
2149au BufNewFile,BufRead Prl*.*,JAM*.*		call s:StarSetf('jam')
2150
2151" Jargon
2152au! BufNewFile,BufRead *jarg*
2153	\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE'
2154	\|  call s:StarSetf('jargon')
2155	\|endif
2156
2157" Java Properties resource file (note: doesn't catch font.properties.pl)
2158au BufNewFile,BufRead *.properties_??_??_*	call s:StarSetf('jproperties')
2159
2160" Kconfig
2161au BufNewFile,BufRead Kconfig.*			call s:StarSetf('kconfig')
2162
2163" Lilo: Linux loader
2164au BufNewFile,BufRead lilo.conf*		call s:StarSetf('lilo')
2165
2166" Logcheck
2167au BufNewFile,BufRead */etc/logcheck/*.d*/*	call s:StarSetf('logcheck')
2168
2169" Makefile
2170au BufNewFile,BufRead [mM]akefile*		call s:StarSetf('make')
2171
2172" Ruby Makefile
2173au BufNewFile,BufRead [rR]akefile*		call s:StarSetf('ruby')
2174
2175" Mail (also matches muttrc.vim, so this is below the other checks)
2176au BufNewFile,BufRead {neo,}mutt[[:alnum:]._-]\\\{6\}	setf mail
2177
2178au BufNewFile,BufRead reportbug-*		call s:StarSetf('mail')
2179
2180" Modconf
2181au BufNewFile,BufRead */etc/modutils/*
2182	\ if executable(expand("<afile>")) != 1
2183	\|  call s:StarSetf('modconf')
2184	\|endif
2185au BufNewFile,BufRead */etc/modprobe.*		call s:StarSetf('modconf')
2186
2187" Mutt setup file
2188au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc*	call s:StarSetf('muttrc')
2189au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc*		call s:StarSetf('muttrc')
2190
2191" Neomutt setup file
2192au BufNewFile,BufRead .neomuttrc*,*/.neomutt/neomuttrc*	call s:StarSetf('neomuttrc')
2193au BufNewFile,BufRead neomuttrc*,Neomuttrc*		call s:StarSetf('neomuttrc')
2194
2195" Nroff macros
2196au BufNewFile,BufRead tmac.*			call s:StarSetf('nroff')
2197
2198" OpenBSD hostname.if
2199au BufNewFile,BufRead /etc/hostname.*		call s:StarSetf('config')
2200
2201" Pam conf
2202au BufNewFile,BufRead */etc/pam.d/*		call s:StarSetf('pamconf')
2203
2204" Printcap and Termcap
2205au BufNewFile,BufRead *printcap*
2206	\ if !did_filetype()
2207	\|  let b:ptcap_type = "print" | call s:StarSetf('ptcap')
2208	\|endif
2209au BufNewFile,BufRead *termcap*
2210	\ if !did_filetype()
2211	\|  let b:ptcap_type = "term" | call s:StarSetf('ptcap')
2212	\|endif
2213
2214" ReDIF
2215" Only used when the .rdf file was not detected to be XML.
2216au BufRead,BufNewFile *.rdf			call dist#ft#Redif()
2217
2218" Remind
2219au BufNewFile,BufRead .reminders*		call s:StarSetf('remind')
2220
2221" SGML catalog file
2222au BufNewFile,BufRead sgml.catalog*		call s:StarSetf('catalog')
2223
2224" Shell scripts ending in a star
2225au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,PKGBUILD*,APKBUILD* call dist#ft#SetFileTypeSH("bash")
2226au BufNewFile,BufRead .kshrc* call dist#ft#SetFileTypeSH("ksh")
2227au BufNewFile,BufRead .profile* call dist#ft#SetFileTypeSH(getline(1))
2228
2229" tcsh scripts ending in a star
2230au BufNewFile,BufRead .tcshrc*	call dist#ft#SetFileTypeShell("tcsh")
2231
2232" csh scripts ending in a star
2233au BufNewFile,BufRead .login*,.cshrc*  call dist#ft#CSH()
2234
2235" VHDL
2236au BufNewFile,BufRead *.vhdl_[0-9]*		call s:StarSetf('vhdl')
2237
2238" Vim script
2239au BufNewFile,BufRead *vimrc*			call s:StarSetf('vim')
2240
2241" Subversion commit file
2242au BufNewFile,BufRead svn-commit*.tmp		setf svn
2243
2244" X resources file
2245au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults')
2246
2247" XFree86 config
2248au BufNewFile,BufRead XF86Config-4*
2249	\ let b:xf86conf_xfree86_version = 4 | call s:StarSetf('xf86conf')
2250au BufNewFile,BufRead XF86Config*
2251	\ if getline(1) =~ '\<XConfigurator\>'
2252	\|  let b:xf86conf_xfree86_version = 3
2253	\|endif
2254	\|call s:StarSetf('xf86conf')
2255
2256" X11 xmodmap
2257au BufNewFile,BufRead *xmodmap*			call s:StarSetf('xmodmap')
2258
2259" Xinetd conf
2260au BufNewFile,BufRead */etc/xinetd.d/*		call s:StarSetf('xinetd')
2261
2262" yum conf (close enough to dosini)
2263au BufNewFile,BufRead */etc/yum.repos.d/*	call s:StarSetf('dosini')
2264
2265" Z-Shell script ending in a star
2266au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump*  call s:StarSetf('zsh')
2267au BufNewFile,BufRead zsh*,zlog*		call s:StarSetf('zsh')
2268
2269
2270" Plain text files, needs to be far down to not override others.  This avoids
2271" the "conf" type being used if there is a line starting with '#'.
2272au BufNewFile,BufRead *.text,README		setf text
2273
2274" Help files match *.txt but should have a last line that is a modeline.
2275au BufNewFile,BufRead *.txt
2276	\  if getline('$') !~ 'vim:.*ft=help'
2277	\|   setf text
2278	\| endif
2279
2280
2281" Use the filetype detect plugins.  They may overrule any of the previously
2282" detected filetypes.
2283runtime! ftdetect/*.vim
2284
2285" NOTE: The above command could have ended the filetypedetect autocmd group
2286" and started another one. Let's make sure it has ended to get to a consistent
2287" state.
2288augroup END
2289
2290" Generic configuration file. Use FALLBACK, it's just guessing!
2291au filetypedetect BufNewFile,BufRead,StdinReadPost *
2292	\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
2293	\    && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
2294	\	|| getline(4) =~ '^#' || getline(5) =~ '^#') |
2295	\   setf FALLBACK conf |
2296	\ endif
2297
2298
2299" If the GUI is already running, may still need to install the Syntax menu.
2300" Don't do it when the 'M' flag is included in 'guioptions'.
2301if has("menu") && has("gui_running")
2302      \ && !exists("did_install_syntax_menu") && &guioptions !~# "M"
2303  source <sfile>:p:h/menu.vim
2304endif
2305
2306" Function called for testing all functions defined here.  These are
2307" script-local, thus need to be executed here.
2308" Returns a string with error messages (hopefully empty).
2309func! TestFiletypeFuncs(testlist)
2310  let output = ''
2311  for f in a:testlist
2312    try
2313      exe f
2314    catch
2315      let output = output . "\n" . f . ": " . v:exception
2316    endtry
2317  endfor
2318  return output
2319endfunc
2320
2321" Restore 'cpoptions'
2322let &cpo = s:cpo_save
2323unlet s:cpo_save
2324