1" Test :setfiletype
2
3func Test_detection()
4  filetype on
5  augroup filetypedetect
6    au BufNewFile,BufRead *	call assert_equal(1, did_filetype())
7  augroup END
8  new something.vim
9  call assert_equal('vim', &filetype)
10
11  bwipe!
12  filetype off
13endfunc
14
15func Test_conf_type()
16  filetype on
17  call writefile(['# some comment', 'must be conf'], 'Xfile')
18  augroup filetypedetect
19    au BufNewFile,BufRead *	call assert_equal(0, did_filetype())
20  augroup END
21  split Xfile
22  call assert_equal('conf', &filetype)
23
24  bwipe!
25  call delete('Xfile')
26  filetype off
27endfunc
28
29func Test_other_type()
30  filetype on
31  augroup filetypedetect
32    au BufNewFile,BufRead *	call assert_equal(0, did_filetype())
33    au BufNewFile,BufRead Xfile	setf testfile
34    au BufNewFile,BufRead *	call assert_equal(1, did_filetype())
35  augroup END
36  call writefile(['# some comment', 'must be conf'], 'Xfile')
37  split Xfile
38  call assert_equal('testfile', &filetype)
39
40  bwipe!
41  call delete('Xfile')
42  filetype off
43endfunc
44
45" Filetypes detected just from matching the file name.
46let s:filename_checks = {
47    \ '8th': ['file.8th'],
48    \ 'a2ps': ['/etc/a2ps.cfg', '/etc/a2ps/file.cfg', 'a2psrc', '.a2psrc', 'any/etc/a2ps.cfg', 'any/etc/a2ps/file.cfg'],
49    \ 'a65': ['file.a65'],
50    \ 'aap': ['file.aap'],
51    \ 'abap': ['file.abap'],
52    \ 'abc': ['file.abc'],
53    \ 'abel': ['file.abl'],
54    \ 'acedb': ['file.wrm'],
55    \ 'ada': ['file.adb', 'file.ads', 'file.ada', 'file.gpr'],
56    \ 'ahdl': ['file.tdf'],
57    \ 'aidl': ['file.aidl'],
58    \ 'alsaconf': ['.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf', 'any/etc/asound.conf', 'any/usr/share/alsa/alsa.conf'],
59    \ 'aml': ['file.aml'],
60    \ 'ampl': ['file.run'],
61    \ 'ant': ['build.xml'],
62    \ 'apache': ['.htaccess', '/etc/httpd/file.conf', '/etc/apache2/sites-2/file.com', '/etc/apache2/some.config', '/etc/apache2/conf.file/conf', '/etc/apache2/mods-some/file', '/etc/apache2/sites-some/file', '/etc/httpd/conf.d/file.config', '/etc/apache2/conf.file/file', '/etc/apache2/file.conf', '/etc/apache2/file.conf-file', '/etc/apache2/mods-file/file', '/etc/apache2/sites-file/file', '/etc/apache2/sites-file/file.com', '/etc/httpd/conf.d/file.conf', '/etc/httpd/conf.d/file.conf-file', 'access.conf', 'access.conf-file', 'any/etc/apache2/conf.file/file', 'any/etc/apache2/file.conf', 'any/etc/apache2/file.conf-file', 'any/etc/apache2/mods-file/file', 'any/etc/apache2/sites-file/file', 'any/etc/apache2/sites-file/file.com', 'any/etc/httpd/conf.d/file.conf', 'any/etc/httpd/conf.d/file.conf-file', 'any/etc/httpd/file.conf', 'apache.conf', 'apache.conf-file', 'apache2.conf', 'apache2.conf-file', 'httpd.conf', 'httpd.conf-file', 'srm.conf', 'srm.conf-file', '/etc/httpd/mods-some/file', '/etc/httpd/sites-some/file', '/etc/httpd/conf.file/conf'],
63    \ 'apachestyle': ['/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'],
64    \ 'applescript': ['file.scpt'],
65    \ 'aptconf': ['apt.conf', '/.aptitude/config', 'any/.aptitude/config'],
66    \ 'arch': ['.arch-inventory', '=tagging-method'],
67    \ 'arduino': ['file.ino', 'file.pde'],
68    \ 'art': ['file.art'],
69    \ 'asciidoc': ['file.asciidoc', 'file.adoc'],
70    \ 'asn': ['file.asn', 'file.asn1'],
71    \ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'],
72    \ 'atlas': ['file.atl', 'file.as'],
73    \ 'autohotkey': ['file.ahk'],
74    \ 'autoit': ['file.au3'],
75    \ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'],
76    \ 'ave': ['file.ave'],
77    \ 'awk': ['file.awk', 'file.gawk'],
78    \ 'b': ['file.mch', 'file.ref', 'file.imp'],
79    \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'],
80    \ 'bc': ['file.bc'],
81    \ 'bdf': ['file.bdf'],
82    \ 'beancount': ['file.beancount'],
83    \ 'bib': ['file.bib'],
84    \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'],
85    \ 'blank': ['file.bl'],
86    \ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'],
87    \ 'bst': ['file.bst'],
88    \ 'bzr': ['bzr_log.any', 'bzr_log.file'],
89    \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'],
90    \ 'cabal': ['file.cabal'],
91    \ 'cabalconfig': ['cabal.config'],
92    \ 'cabalproject': ['cabal.project', 'cabal.project.local'],
93    \ 'calendar': ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'],
94    \ 'catalog': ['catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'],
95    \ 'cdl': ['file.cdl'],
96    \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'],
97    \ 'cdrtoc': ['file.toc'],
98    \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'],
99    \ 'cfengine': ['cfengine.conf'],
100    \ 'cfg': ['file.cfg', 'file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'],
101    \ 'ch': ['file.chf'],
102    \ 'chaiscript': ['file.chai'],
103    \ 'chaskell': ['file.chs'],
104    \ 'chill': ['file..ch'],
105    \ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'],
106    \ 'cl': ['file.eni'],
107    \ 'clean': ['file.dcl', 'file.icl'],
108    \ 'clojure': ['file.clj', 'file.cljs', 'file.cljx', 'file.cljc'],
109    \ 'cmake': ['CMakeLists.txt', 'file.cmake', 'file.cmake.in'],
110    \ 'cmusrc': ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'],
111    \ 'cobol': ['file.cbl', 'file.cob', 'file.lib'],
112    \ 'coco': ['file.atg'],
113    \ 'conaryrecipe': ['file.recipe'],
114    \ 'conf': ['auto.master'],
115    \ 'config': ['configure.in', 'configure.ac', '/etc/hostname.file'],
116    \ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'],
117    \ 'cpp': ['file.cxx', 'file.c++', 'file.hh', 'file.hxx', 'file.hpp', 'file.ipp', 'file.moc', 'file.tcc', 'file.inl', 'file.tlh'],
118    \ 'crm': ['file.crm'],
119    \ 'crontab': ['crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'],
120    \ 'cs': ['file.cs'],
121    \ 'csc': ['file.csc'],
122    \ 'csdl': ['file.csdl'],
123    \ 'csp': ['file.csp', 'file.fdr'],
124    \ 'css': ['file.css'],
125    \ 'cterm': ['file.con'],
126    \ 'cucumber': ['file.feature'],
127    \ 'cuda': ['file.cu', 'file.cuh'],
128    \ 'cupl': ['file.pld'],
129    \ 'cuplsim': ['file.si'],
130    \ 'cvs': ['cvs123'],
131    \ 'cvsrc': ['.cvsrc'],
132    \ 'cynpp': ['file.cyn'],
133    \ 'dart': ['file.dart', 'file.drt'],
134    \ 'datascript': ['file.ds'],
135    \ 'dcd': ['file.dcd'],
136    \ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'],
137    \ 'debcontrol': ['/debian/control', 'any/debian/control'],
138    \ 'debcopyright': ['/debian/copyright', 'any/debian/copyright'],
139    \ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list', 'any/etc/apt/sources.list', 'any/etc/apt/sources.list.d/file.list'],
140    \ 'def': ['file.def'],
141    \ 'denyhosts': ['denyhosts.conf'],
142    \ 'desc': ['file.desc'],
143    \ 'desktop': ['file.desktop', '.directory', 'file.directory'],
144    \ 'dictconf': ['dict.conf', '.dictrc'],
145    \ 'dictdconf': ['dictd.conf', 'dictdfile.conf', 'dictd-file.conf'],
146    \ 'diff': ['file.diff', 'file.rej'],
147    \ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'],
148    \ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
149    \ 'dockerfile': ['Containerfile', 'Dockerfile', 'file.Dockerfile'],
150    \ 'dosbatch': ['file.bat', 'file.sys'],
151    \ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'],
152    \ 'dot': ['file.dot', 'file.gv'],
153    \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
154    \ 'dtd': ['file.dtd'],
155    \ 'dts': ['file.dts', 'file.dtsi'],
156    \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'],
157    \ 'dylan': ['file.dylan'],
158    \ 'dylanintr': ['file.intr'],
159    \ 'dylanlid': ['file.lid'],
160    \ 'ecd': ['file.ecd'],
161    \ 'edif': ['file.edf', 'file.edif', 'file.edo'],
162    \ 'elinks': ['elinks.conf'],
163    \ 'elixir': ['file.ex', 'file.exs', 'mix.lock'],
164    \ 'eelixir': ['file.eex', 'file.leex'],
165    \ 'elm': ['file.elm'],
166    \ 'elmfilt': ['filter-rules'],
167    \ 'epuppet': ['file.epp'],
168    \ 'erlang': ['file.erl', 'file.hrl', 'file.yaws'],
169    \ 'eruby': ['file.erb', 'file.rhtml'],
170    \ 'esmtprc': ['anyesmtprc', 'esmtprc', 'some-esmtprc'],
171    \ 'esqlc': ['file.ec', 'file.EC'],
172    \ 'esterel': ['file.strl'],
173    \ 'eterm': ['anyEterm/file.cfg', 'Eterm/file.cfg', 'some-Eterm/file.cfg'],
174    \ 'exim': ['exim.conf'],
175    \ 'expect': ['file.exp'],
176    \ 'exports': ['exports'],
177    \ 'factor': ['file.factor'],
178    \ 'falcon': ['file.fal'],
179    \ 'fan': ['file.fan', 'file.fwt'],
180    \ 'fennel': ['file.fnl'],
181    \ 'fetchmail': ['.fetchmailrc'],
182    \ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
183    \ 'fish': ['file.fish'],
184    \ 'focexec': ['file.fex', 'file.focexec'],
185    \ 'forth': ['file.fs', 'file.ft', 'file.fth'],
186    \ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
187    \ 'fpcmake': ['file.fpc'],
188    \ 'framescript': ['file.fsl'],
189    \ 'freebasic': ['file.fb', 'file.bi'],
190    \ 'fstab': ['fstab', 'mtab'],
191    \ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file'],
192    \ 'gdb': ['.gdbinit', 'gdbinit'],
193    \ 'gdmo': ['file.mo', 'file.gdmo'],
194    \ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'],
195    \ 'gemtext': ['file.gmi', 'file.gemini'],
196    \ 'gift': ['file.gift'],
197    \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'],
198    \ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'],
199    \ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'],
200    \ 'gitrebase': ['git-rebase-todo'],
201    \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'],
202    \ 'gkrellmrc': ['gkrellmrc', 'gkrellmrc_x'],
203    \ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'],
204    \ 'gnuplot': ['file.gpi'],
205    \ 'go': ['file.go'],
206    \ 'gp': ['file.gp', '.gprc'],
207    \ 'gpg': ['/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel', 'any/.gnupg/gpg.conf', 'any/.gnupg/options', 'any/usr/any/gnupg/options.skel'],
208    \ 'grads': ['file.gs'],
209    \ 'gretl': ['file.gretl'],
210    \ 'groovy': ['file.gradle', 'file.groovy'],
211    \ 'group': ['any/etc/group', 'any/etc/group-', 'any/etc/group.edit', 'any/etc/gshadow', 'any/etc/gshadow-', 'any/etc/gshadow.edit', 'any/var/backups/group.bak', 'any/var/backups/gshadow.bak', '/etc/group', '/etc/group-', '/etc/group.edit', '/etc/gshadow', '/etc/gshadow-', '/etc/gshadow.edit', '/var/backups/group.bak', '/var/backups/gshadow.bak'],
212    \ 'grub': ['/boot/grub/menu.lst', '/boot/grub/grub.conf', '/etc/grub.conf', 'any/boot/grub/grub.conf', 'any/boot/grub/menu.lst', 'any/etc/grub.conf'],
213    \ 'gsp': ['file.gsp'],
214    \ 'gtkrc': ['.gtkrc', 'gtkrc', '.gtkrc-file', 'gtkrc-file'],
215    \ 'haml': ['file.haml'],
216    \ 'hamster': ['file.hsm'],
217    \ 'haskell': ['file.hs', 'file.hsc', 'file.hs-boot', 'file.hsig'],
218    \ 'haste': ['file.ht'],
219    \ 'hastepreproc': ['file.htpp'],
220    \ 'hb': ['file.hb'],
221    \ 'hercules': ['file.vc', 'file.ev', 'file.sum', 'file.errsum'],
222    \ 'hex': ['file.hex', 'file.h32'],
223    \ 'hgcommit': ['hg-editor-file.txt'],
224    \ 'hog': ['file.hog', 'snort.conf', 'vision.conf'],
225    \ 'hollywood': ['file.hws'],
226    \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'],
227    \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'],
228    \ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'],
229    \ 'modula3': ['file.m3', 'file.mg', 'file.i3', 'file.ig'],
230    \ 'natural': ['file.NSA', 'file.NSC', 'file.NSG', 'file.NSL', 'file.NSM', 'file.NSN', 'file.NSP', 'file.NSS'],
231    \ 'neomuttrc': ['Neomuttrc', '.neomuttrc', '.neomuttrc-file', '/.neomutt/neomuttrc', '/.neomutt/neomuttrc-file', 'Neomuttrc', 'Neomuttrc-file', 'any/.neomutt/neomuttrc', 'any/.neomutt/neomuttrc-file', 'neomuttrc', 'neomuttrc-file'],
232    \ 'opl': ['file.OPL', 'file.OPl', 'file.OpL', 'file.Opl', 'file.oPL', 'file.oPl', 'file.opL', 'file.opl'],
233    \ 'pcmk': ['file.pcmk'],
234    \ 'r': ['file.r'],
235    \ 'rhelp': ['file.rd'],
236    \ 'rmd': ['file.rmd', 'file.smd'],
237    \ 'rnoweb': ['file.rnw', 'file.snw'],
238    \ 'rrst': ['file.rrst', 'file.srst'],
239    \ 'template': ['file.tmpl'],
240    \ 'htmlm4': ['file.html.m4'],
241    \ 'httest': ['file.htt', 'file.htb'],
242    \ 'ibasic': ['file.iba', 'file.ibi'],
243    \ 'icemenu': ['/.icewm/menu', 'any/.icewm/menu'],
244    \ 'icon': ['file.icn'],
245    \ 'indent': ['.indent.pro', 'indentrc'],
246    \ 'inform': ['file.inf', 'file.INF'],
247    \ 'initng': ['/etc/initng/any/file.i', 'file.ii', 'any/etc/initng/any/file.i'],
248    \ 'inittab': ['inittab'],
249    \ 'ipfilter': ['ipf.conf', 'ipf6.conf', 'ipf.rules'],
250    \ 'iss': ['file.iss'],
251    \ 'ist': ['file.ist', 'file.mst'],
252    \ 'j': ['file.ijs'],
253    \ 'jal': ['file.jal', 'file.JAL'],
254    \ 'jam': ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'],
255    \ 'java': ['file.java', 'file.jav'],
256    \ 'javacc': ['file.jj', 'file.jjt'],
257    \ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'],
258    \ 'javascriptreact': ['file.jsx'],
259    \ 'jess': ['file.clp'],
260    \ 'jgraph': ['file.jgr'],
261    \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'],
262    \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file'],
263    \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', '.babelrc', '.eslintrc', '.prettierrc', '.firebaserc'],
264    \ 'jsonc': ['file.jsonc'],
265    \ 'jsp': ['file.jsp'],
266    \ 'julia': ['file.jl'],
267    \ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file'],
268    \ 'kivy': ['file.kv'],
269    \ 'kix': ['file.kix'],
270    \ 'kotlin': ['file.kt', 'file.ktm', 'file.kts'],
271    \ 'kscript': ['file.ks'],
272    \ 'kwt': ['file.k'],
273    \ 'lace': ['file.ace', 'file.ACE'],
274    \ 'latte': ['file.latte', 'file.lte'],
275    \ 'ld': ['file.ld'],
276    \ 'ldif': ['file.ldif'],
277    \ 'less': ['file.less'],
278    \ 'lex': ['file.lex', 'file.l', 'file.lxx', 'file.l++'],
279    \ 'lftp': ['lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'],
280    \ 'lhaskell': ['file.lhs'],
281    \ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'],
282    \ 'lifelines': ['file.ll'],
283    \ 'lilo': ['lilo.conf', 'lilo.conf-file'],
284    \ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
285    \ 'liquid': ['file.liquid'],
286    \ 'lisp': ['file.lsp', 'file.lisp', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
287    \ 'lite': ['file.lite', 'file.lt'],
288    \ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'],
289    \ 'loginaccess': ['/etc/login.access', 'any/etc/login.access'],
290    \ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'],
291    \ 'logtalk': ['file.lgt'],
292    \ 'lotos': ['file.lot', 'file.lotos'],
293    \ 'lout': ['file.lou', 'file.lout'],
294    \ 'lprolog': ['file.sig'],
295    \ 'lsl': ['file.lsl'],
296    \ 'lss': ['file.lss'],
297    \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'],
298    \ 'lynx': ['lynx.cfg'],
299    \ 'matlab': ['file.m'],
300    \ 'm3build': ['m3makefile', 'm3overrides'],
301    \ 'm3quake': ['file.quake', 'cm3.cfg'],
302    \ 'm4': ['file.at'],
303    \ 'mail': ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'],
304    \ 'mailaliases': ['/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'],
305    \ 'mailcap': ['.mailcap', 'mailcap'],
306    \ 'make': ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile'],
307    \ 'mallard': ['file.page'],
308    \ 'man': ['file.man'],
309    \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'],
310    \ 'map': ['file.map'],
311    \ 'maple': ['file.mv', 'file.mpl', 'file.mws'],
312    \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'],
313    \ 'mason': ['file.mason', 'file.mhtml', 'file.comp'],
314    \ 'master': ['file.mas', 'file.master'],
315    \ 'mel': ['file.mel'],
316    \ 'meson': ['meson.build', 'meson_options.txt'],
317    \ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user',
318    \     '/log/auth.log', '/log/cron.log', '/log/daemon.log', '/log/debug.log', '/log/kern.log', '/log/lpr.log', '/log/mail.log', '/log/messages.log', '/log/news/news.log', '/log/syslog.log', '/log/user.log',
319    \     '/log/auth.err', '/log/cron.err', '/log/daemon.err', '/log/debug.err', '/log/kern.err', '/log/lpr.err', '/log/mail.err', '/log/messages.err', '/log/news/news.err', '/log/syslog.err', '/log/user.err',
320    \      '/log/auth.info', '/log/cron.info', '/log/daemon.info', '/log/debug.info', '/log/kern.info', '/log/lpr.info', '/log/mail.info', '/log/messages.info', '/log/news/news.info', '/log/syslog.info', '/log/user.info',
321    \      '/log/auth.warn', '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', '/log/messages.warn', '/log/news/news.warn', '/log/syslog.warn', '/log/user.warn',
322    \      '/log/auth.crit', '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', '/log/messages.crit', '/log/news/news.crit', '/log/syslog.crit', '/log/user.crit',
323    \      '/log/auth.notice', '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', '/log/messages.notice', '/log/news/news.notice', '/log/syslog.notice', '/log/user.notice'],
324    \ 'mf': ['file.mf'],
325    \ 'mgl': ['file.mgl'],
326    \ 'mgp': ['file.mgp'],
327    \ 'mib': ['file.mib', 'file.my'],
328    \ 'mix': ['file.mix', 'file.mixal'],
329    \ 'mma': ['file.nb'],
330    \ 'mmp': ['file.mmp'],
331    \ 'modconf': ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'],
332    \ 'modula2': ['file.m2', 'file.mi'],
333    \ 'monk': ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'],
334    \ 'moo': ['file.moo'],
335    \ 'mp': ['file.mp'],
336    \ 'mplayerconf': ['mplayer.conf', '/.mplayer/config', 'any/.mplayer/config'],
337    \ 'mrxvtrc': ['mrxvtrc', '.mrxvtrc'],
338    \ 'msidl': ['file.odl', 'file.mof'],
339    \ 'msql': ['file.msql'],
340    \ 'mupad': ['file.mu'],
341    \ 'mush': ['file.mush'],
342    \ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'],
343    \ 'mysql': ['file.mysql'],
344    \ 'n1ql': ['file.n1ql', 'file.nql'],
345    \ 'named': ['namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'],
346    \ 'nanorc': ['/etc/nanorc', 'file.nanorc', 'any/etc/nanorc'],
347    \ 'ncf': ['file.ncf'],
348    \ 'netrc': ['.netrc'],
349    \ 'nginx': ['file.nginx', 'nginxfile.conf', 'filenginx.conf', 'any/etc/nginx/file', 'any/usr/local/nginx/conf/file', 'any/nginx/file.conf'],
350    \ 'ninja': ['file.ninja'],
351    \ 'nqc': ['file.nqc'],
352    \ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom', 'tmac.file'],
353    \ 'nsis': ['file.nsi', 'file.nsh'],
354    \ 'obj': ['file.obj'],
355    \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'],
356    \ 'occam': ['file.occ'],
357    \ 'octave': ['octaverc', '.octaverc', 'octave.conf'],
358    \ 'omnimark': ['file.xom', 'file.xin'],
359    \ 'opam': ['opam', 'file.opam', 'file.opam.template'],
360    \ 'openroad': ['file.or'],
361    \ 'ora': ['file.ora'],
362    \ 'pamconf': ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'],
363    \ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'],
364    \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'],
365    \ 'pascal': ['file.pas', 'file.dpr', 'file.lpr'],
366    \ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak', '/etc/passwd', '/etc/passwd-', '/etc/passwd.edit', '/etc/shadow', '/etc/shadow-', '/etc/shadow.edit', '/var/backups/passwd.bak', '/var/backups/shadow.bak'],
367    \ 'pbtxt': ['file.pbtxt'],
368    \ 'pccts': ['file.g'],
369    \ 'pdf': ['file.pdf'],
370    \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'],
371    \ 'pf': ['pf.conf'],
372    \ 'pfmain': ['main.cf'],
373    \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'],
374    \ 'lpc': ['file.lpc', 'file.ulpc'],
375    \ 'pike': ['file.pike', 'file.pmod'],
376    \ 'cmod': ['file.cmod'],
377    \ 'pilrc': ['file.rcp'],
378    \ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'],
379    \ 'pinfo': ['/etc/pinforc', '/.pinforc', 'any/.pinforc', 'any/etc/pinforc'],
380    \ 'pli': ['file.pli', 'file.pl1'],
381    \ 'plm': ['file.plm', 'file.p36', 'file.pac'],
382    \ 'plp': ['file.plp'],
383    \ 'plsql': ['file.pls', 'file.plsql'],
384    \ 'po': ['file.po', 'file.pot'],
385    \ 'pod': ['file.pod'],
386    \ 'poke': ['file.pk'],
387    \ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'],
388    \ 'pov': ['file.pov'],
389    \ 'povini': ['.povrayrc'],
390    \ 'ppd': ['file.ppd'],
391    \ 'ppwiz': ['file.it', 'file.ih'],
392    \ 'privoxy': ['file.action'],
393    \ 'proc': ['file.pc'],
394    \ 'procmail': ['.procmail', '.procmailrc'],
395    \ 'prolog': ['file.pdb'],
396    \ 'promela': ['file.pml'],
397    \ 'proto': ['file.proto'],
398    \ 'protocols': ['/etc/protocols', 'any/etc/protocols'],
399    \ 'ps1': ['file.ps1', 'file.psd1', 'file.psm1', 'file.pssc'],
400    \ 'ps1xml': ['file.ps1xml'],
401    \ 'psf': ['file.psf'],
402    \ 'psl': ['file.psl'],
403    \ 'puppet': ['file.pp'],
404    \ 'pyret': ['file.arr'],
405    \ 'pyrex': ['file.pyx', 'file.pxd'],
406    \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'],
407    \ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'],
408    \ 'radiance': ['file.rad', 'file.mat'],
409    \ 'raku': ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'],
410    \ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
411    \ 'rbs': ['file.rbs'],
412    \ 'rc': ['file.rc', 'file.rch'],
413    \ 'rcs': ['file,v'],
414    \ 'readline': ['.inputrc', 'inputrc'],
415    \ 'remind': ['.reminders', 'file.remind', 'file.rem', '.reminders-file'],
416    \ 'rego': ['file.rego'],
417    \ 'resolv': ['resolv.conf'],
418    \ 'reva': ['file.frt'],
419    \ 'rexx': ['file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'],
420    \ 'rib': ['file.rib'],
421    \ 'rnc': ['file.rnc'],
422    \ 'rng': ['file.rng'],
423    \ 'robots': ['robots.txt'],
424    \ 'routeros': ['file.rsc'],
425    \ 'rpcgen': ['file.x'],
426    \ 'rpl': ['file.rpl'],
427    \ 'rst': ['file.rst'],
428    \ 'rtf': ['file.rtf'],
429    \ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile'],
430    \ 'rust': ['file.rs'],
431    \ 'samba': ['smb.conf'],
432    \ 'sas': ['file.sas'],
433    \ 'sass': ['file.sass'],
434    \ 'sather': ['file.sa'],
435    \ 'sbt': ['file.sbt'],
436    \ 'scala': ['file.scala', 'file.sc'],
437    \ 'scheme': ['file.scm', 'file.ss', 'file.rkt', 'file.rktd', 'file.rktl'],
438    \ 'scilab': ['file.sci', 'file.sce'],
439    \ 'screen': ['.screenrc', 'screenrc'],
440    \ 'sexplib': ['file.sexp'],
441    \ 'scdoc': ['file.scd'],
442    \ 'scss': ['file.scss'],
443    \ 'sd': ['file.sd'],
444    \ 'sdc': ['file.sdc'],
445    \ 'sdl': ['file.sdl', 'file.pr'],
446    \ 'sed': ['file.sed'],
447    \ 'svelte': ['file.svelte'],
448    \ 'sensors': ['/etc/sensors.conf', '/etc/sensors3.conf', 'any/etc/sensors.conf', 'any/etc/sensors3.conf'],
449    \ 'services': ['/etc/services', 'any/etc/services'],
450    \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'],
451    \ 'sh': ['.bashrc', 'file.bash', '/usr/share/doc/bash-completion/filter.sh','/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf'],
452    \ 'sieve': ['file.siv', 'file.sieve'],
453    \ 'simula': ['file.sim'],
454    \ 'sinda': ['file.sin', 'file.s85'],
455    \ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'],
456    \ 'skill': ['file.il', 'file.ils', 'file.cdf'],
457    \ 'slang': ['file.sl'],
458    \ 'slice': ['file.ice'],
459    \ 'slpconf': ['/etc/slp.conf', 'any/etc/slp.conf'],
460    \ 'slpreg': ['/etc/slp.reg', 'any/etc/slp.reg'],
461    \ 'slpspi': ['/etc/slp.spi', 'any/etc/slp.spi'],
462    \ 'slrnrc': ['.slrnrc'],
463    \ 'slrnsc': ['file.score'],
464    \ 'sm': ['sendmail.cf'],
465    \ 'smarty': ['file.tpl'],
466    \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'],
467    \ 'smith': ['file.smt', 'file.smith'],
468    \ 'sml': ['file.sml'],
469    \ 'snobol4': ['file.sno', 'file.spt'],
470    \ 'sparql': ['file.rq', 'file.sparql'],
471    \ 'spec': ['file.spec'],
472    \ 'spice': ['file.sp', 'file.spice'],
473    \ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
474    \ 'spyce': ['file.spy', 'file.spi'],
475    \ 'sql': ['file.tyb', 'file.typ', 'file.tyc', 'file.pkb', 'file.pks'],
476    \ 'sqlj': ['file.sqlj'],
477    \ 'sqr': ['file.sqr', 'file.sqi'],
478    \ 'squid': ['squid.conf'],
479    \ 'srec': ['file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'],
480    \ 'sshconfig': ['ssh_config', '/.ssh/config', '/etc/ssh/ssh_config.d/file.conf', 'any/etc/ssh/ssh_config.d/file.conf', 'any/.ssh/config'],
481    \ 'sshdconfig': ['sshd_config', '/etc/ssh/sshd_config.d/file.conf', 'any/etc/ssh/sshd_config.d/file.conf'],
482    \ 'st': ['file.st'],
483    \ 'stata': ['file.ado', 'file.do', 'file.imata', 'file.mata'],
484    \ 'stp': ['file.stp'],
485    \ 'sudoers': ['any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers'],
486    \ 'svg': ['file.svg'],
487    \ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'],
488    \ 'swift': ['file.swift'],
489    \ 'swiftgyb': ['file.swift.gyb'],
490    \ 'sil': ['file.sil'],
491    \ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'],
492    \ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.dnssd', 'any/systemd/file.link', 'any/systemd/file.mount', 'any/systemd/file.netdev', 'any/systemd/file.network', 'any/systemd/file.nspawn', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.slice', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer', '/etc/systemd/some.conf.d/file.conf', '/etc/systemd/system/some.d/file.conf', '/etc/systemd/system/some.d/.#file', '/etc/systemd/system/.#otherfile', '/home/user/.config/systemd/user/some.d/mine.conf', '/home/user/.config/systemd/user/some.d/.#file', '/home/user/.config/systemd/user/.#otherfile', '/.config/systemd/user/.#', '/.config/systemd/user/.#-file', '/.config/systemd/user/file.d/.#', '/.config/systemd/user/file.d/.#-file', '/.config/systemd/user/file.d/file.conf', '/etc/systemd/file.conf.d/file.conf', '/etc/systemd/system/.#', '/etc/systemd/system/.#-file', '/etc/systemd/system/file.d/.#', '/etc/systemd/system/file.d/.#-file', '/etc/systemd/system/file.d/file.conf', '/systemd/file.automount', '/systemd/file.dnssd', '/systemd/file.link', '/systemd/file.mount', '/systemd/file.netdev', '/systemd/file.network', '/systemd/file.nspawn', '/systemd/file.path', '/systemd/file.service', '/systemd/file.slice', '/systemd/file.socket', '/systemd/file.swap', '/systemd/file.target', '/systemd/file.timer', 'any/.config/systemd/user/.#', 'any/.config/systemd/user/.#-file', 'any/.config/systemd/user/file.d/.#', 'any/.config/systemd/user/file.d/.#-file', 'any/.config/systemd/user/file.d/file.conf', 'any/etc/systemd/file.conf.d/file.conf', 'any/etc/systemd/system/.#', 'any/etc/systemd/system/.#-file', 'any/etc/systemd/system/file.d/.#', 'any/etc/systemd/system/file.d/.#-file', 'any/etc/systemd/system/file.d/file.conf'],
493    \ 'systemverilog': ['file.sv', 'file.svh'],
494    \ 'tags': ['tags'],
495    \ 'tak': ['file.tak'],
496    \ 'taskdata': ['pending.data', 'completed.data', 'undo.data'],
497    \ 'taskedit': ['file.task'],
498    \ 'tcl': ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc'],
499    \ 'teraterm': ['file.ttl'],
500    \ 'terminfo': ['file.ti'],
501    \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'],
502    \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'],
503    \ 'texmf': ['texmf.cnf'],
504    \ 'text': ['file.text', 'README', '/usr/share/doc/bash-completion/AUTHORS'],
505    \ 'tf': ['file.tf', '.tfrc', 'tfrc'],
506    \ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'],
507    \ 'tilde': ['file.t.html'],
508    \ 'tli': ['file.tli'],
509    \ 'tmux': ['tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf', 'tmux.conf.local'],
510    \ 'toml': ['file.toml', 'Gopkg.lock', 'Pipfile', '/home/user/.cargo/config'],
511    \ 'tpp': ['file.tpp'],
512    \ 'treetop': ['file.treetop'],
513    \ 'trustees': ['trustees.conf'],
514    \ 'tsalt': ['file.slt'],
515    \ 'tsscl': ['file.tsscl'],
516    \ 'tssgm': ['file.tssgm'],
517    \ 'tssop': ['file.tssop'],
518    \ 'twig': ['file.twig'],
519    \ 'typescriptreact': ['file.tsx'],
520    \ 'uc': ['file.uc'],
521    \ 'udevconf': ['/etc/udev/udev.conf', 'any/etc/udev/udev.conf'],
522    \ 'udevperm': ['/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'],
523    \ 'udevrules': ['/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'],
524    \ 'uil': ['file.uit', 'file.uil'],
525    \ 'updatedb': ['/etc/updatedb.conf', 'any/etc/updatedb.conf'],
526    \ 'upstart': ['/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override', 'any/.config/upstart/file.conf', 'any/.config/upstart/file.override', 'any/.init/file.conf', 'any/.init/file.override', 'any/etc/init/file.conf', 'any/etc/init/file.override', 'any/usr/share/upstart/file.conf', 'any/usr/share/upstart/file.override'],
527    \ 'upstreamdat': ['upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'],
528    \ 'upstreaminstalllog': ['upstreaminstall.log', 'UPSTREAMINSTALL.LOG', 'upstreaminstall.file.log', 'UPSTREAMINSTALL.FILE.LOG', 'file.upstreaminstall.log', 'FILE.UPSTREAMINSTALL.LOG'],
529    \ 'upstreamlog': ['fdrupstream.log', 'upstream.log', 'UPSTREAM.LOG', 'upstream.file.log', 'UPSTREAM.FILE.LOG', 'file.upstream.log', 'FILE.UPSTREAM.LOG', 'UPSTREAM-file.log', 'UPSTREAM-FILE.LOG'],
530    \ 'usserverlog': ['usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'],
531    \ 'usw2kagtlog': ['usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'],
532    \ 'vb': ['file.sba', 'file.vb', 'file.vbs', 'file.dsm', 'file.ctl'],
533    \ 'vera': ['file.vr', 'file.vri', 'file.vrh'],
534    \ 'verilog': ['file.v'],
535    \ 'verilogams': ['file.va', 'file.vams'],
536    \ 'vgrindefs': ['vgrindefs'],
537    \ 'vhdl': ['file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst', 'file.vhdl_123', 'file.vho', 'some.vhdl_1', 'some.vhdl_1-file'],
538    \ 'vim': ['file.vim', 'file.vba', '.exrc', '_exrc', 'some-vimrc', 'some-vimrc-file', 'vimrc', 'vimrc-file'],
539    \ 'viminfo': ['.viminfo', '_viminfo'],
540    \ 'vmasm': ['file.mar'],
541    \ 'voscm': ['file.cm'],
542    \ 'vrml': ['file.wrl'],
543    \ 'vroom': ['file.vroom'],
544    \ 'vue': ['file.vue'],
545    \ 'wast': ['file.wast', 'file.wat'],
546    \ 'webmacro': ['file.wm'],
547    \ 'wget': ['.wgetrc', 'wgetrc'],
548    \ 'winbatch': ['file.wbt'],
549    \ 'wml': ['file.wml'],
550    \ 'wsh': ['file.wsf', 'file.wsc'],
551    \ 'wsml': ['file.wsml'],
552    \ 'wvdial': ['wvdial.conf', '.wvdialrc'],
553    \ 'xdefaults': ['.Xdefaults', '.Xpdefaults', '.Xresources', 'xdm-config', 'file.ad', '/Xresources/file', '/app-defaults/file', 'Xresources', 'Xresources-file', 'any/Xresources/file', 'any/app-defaults/file'],
554    \ 'xhtml': ['file.xhtml', 'file.xht'],
555    \ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'],
556    \ 'xmath': ['file.msc', 'file.msf'],
557    \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd'],
558    \ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'],
559    \ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
560    \ 'xpm': ['file.xpm'],
561    \ 'xpm2': ['file.xpm2'],
562    \ 'xquery': ['file.xq', 'file.xql', 'file.xqm', 'file.xquery', 'file.xqy'],
563    \ 'xs': ['file.xs'],
564    \ 'xsd': ['file.xsd'],
565    \ 'xslt': ['file.xsl', 'file.xslt'],
566    \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'],
567    \ 'yaml': ['file.yaml', 'file.yml'],
568    \ 'raml': ['file.raml'],
569    \ 'z8a': ['file.z8a'],
570    \ 'zimbu': ['file.zu'],
571    \ 'zimbutempl': ['file.zut'],
572    \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
573    \
574    \ 'help': [$VIMRUNTIME . '/doc/help.txt'],
575    \ }
576
577let s:filename_case_checks = {
578    \ 'modula2': ['file.DEF', 'file.MOD'],
579    \ 'bzl': ['file.BUILD', 'BUILD'],
580    \ }
581
582func CheckItems(checks)
583  set noswapfile
584  for [ft, names] in items(a:checks)
585    for i in range(0, len(names) - 1)
586      new
587      try
588        exe 'edit ' . fnameescape(names[i])
589      catch
590	call assert_report('cannot edit "' . names[i] . '": ' . v:exception)
591      endtry
592      if &filetype == '' && &readonly
593	" File exists but not able to edit it (permission denied)
594      else
595	call assert_equal(ft, &filetype, 'with file name: ' . names[i])
596      endif
597      bwipe!
598    endfor
599  endfor
600  set swapfile&
601endfunc
602
603func Test_filetype_detection()
604  filetype on
605  call CheckItems(s:filename_checks)
606  if has('fname_case')
607    call CheckItems(s:filename_case_checks)
608  endif
609  filetype off
610endfunc
611
612" Filetypes detected from the file contents by scripts.vim
613let s:script_checks = {
614      \ 'virata': [['% Virata'],
615      \		['', '% Virata'],
616      \		['', '', '% Virata'],
617      \		['', '', '', '% Virata'],
618      \		['', '', '', '', '% Virata']],
619      \ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
620      \		['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
621      \		['__libc_start_main and something']],
622      \ 'clojure': [['#!/path/clojure']],
623      \ 'scala': [['#!/path/scala']],
624      \ 'tcsh': [['#!/path/tcsh']],
625      \ 'zsh': [['#!/path/zsh']],
626      \ 'tcl': [['#!/path/tclsh'],
627      \         ['#!/path/wish'],
628      \         ['#!/path/expectk'],
629      \         ['#!/path/itclsh'],
630      \         ['#!/path/itkwish']],
631      \ 'expect': [['#!/path/expect']],
632      \ 'gnuplot': [['#!/path/gnuplot']],
633      \ 'make': [['#!/path/make']],
634      \ 'pike': [['#!/path/pike'],
635      \          ['#!/path/pike0'],
636      \          ['#!/path/pike9']],
637      \ 'lua': [['#!/path/lua']],
638      \ 'raku': [['#!/path/raku']],
639      \ 'perl': [['#!/path/perl']],
640      \ 'php': [['#!/path/php']],
641      \ 'python': [['#!/path/python'],
642      \            ['#!/path/python2'],
643      \            ['#!/path/python3']],
644      \ 'groovy': [['#!/path/groovy']],
645      \ 'ruby': [['#!/path/ruby']],
646      \ 'javascript': [['#!/path/node'],
647      \                ['#!/path/js'],
648      \                ['#!/path/nodejs'],
649      \                ['#!/path/rhino']],
650      \ 'bc': [['#!/path/bc']],
651      \ 'sed': [['#!/path/sed']],
652      \ 'ocaml': [['#!/path/ocaml']],
653      \ 'awk': [['#!/path/awk'],
654      \         ['#!/path/gawk']],
655      \ 'wml': [['#!/path/wml']],
656      \ 'scheme': [['#!/path/scheme']],
657      \ 'cfengine': [['#!/path/cfengine']],
658      \ 'erlang': [['#!/path/escript']],
659      \ 'haskell': [['#!/path/haskell']],
660      \ 'cpp': [['// Standard iostream objects -*- C++ -*-'],
661      \         ['// -*- C++ -*-']],
662      \ 'yaml': [['%YAML 1.2']],
663      \ 'pascal': [['#!/path/instantfpc']],
664      \ 'fennel': [['#!/path/fennel']],
665      \ 'routeros': [['#!/path/rsc']],
666      \ 'fish': [['#!/path/fish']],
667      \ }
668
669" Various forms of "env" optional arguments.
670let s:script_env_checks = {
671      \ 'perl': [['#!/usr/bin/env VAR=val perl']],
672      \ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']],
673      \ 'awk': [['#!/usr/bin/env VAR=val -i awk']],
674      \ 'scheme': [['#!/usr/bin/env VAR=val --ignore-environment scheme']],
675      \ 'python': [['#!/usr/bin/env VAR=val -S python -w -T']],
676      \ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']],
677      \ }
678
679func Run_script_detection(test_dict)
680  filetype on
681  for [ft, files] in items(a:test_dict)
682    for file in files
683      call writefile(file, 'Xtest')
684      split Xtest
685      call assert_equal(ft, &filetype, 'for text: ' . string(file))
686      bwipe!
687    endfor
688  endfor
689  call delete('Xtest')
690  filetype off
691endfunc
692
693func Test_script_detection()
694  call Run_script_detection(s:script_checks)
695  call Run_script_detection(s:script_env_checks)
696endfunc
697
698func Test_setfiletype_completion()
699  call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx')
700  call assert_equal('"setfiletype java javacc javascript javascriptreact', @:)
701endfunc
702
703" Test for ':filetype detect' command for a buffer without a file
704func Test_emptybuf_ftdetect()
705  new
706  call setline(1, '#!/bin/sh')
707  call assert_equal('', &filetype)
708  filetype detect
709  call assert_equal('sh', &filetype)
710  close!
711endfunc
712
713" Test for ':filetype indent on' and ':filetype indent off' commands
714func Test_filetype_indent_off()
715  new Xtest.vim
716  filetype indent on
717  call assert_equal(1, g:did_indent_on)
718  call assert_equal(['filetype detection:ON  plugin:OFF  indent:ON'],
719        \ execute('filetype')->split("\n"))
720  filetype indent off
721  call assert_equal(0, exists('g:did_indent_on'))
722  call assert_equal(['filetype detection:ON  plugin:OFF  indent:OFF'],
723        \ execute('filetype')->split("\n"))
724  close
725endfunc
726
727func Test_hook_file()
728  filetype on
729
730  call writefile(['[Trigger]', 'this is pacman config'], 'Xfile.hook')
731  split Xfile.hook
732  call assert_equal('dosini', &filetype)
733  bwipe!
734
735  call writefile(['not pacman'], 'Xfile.hook')
736  split Xfile.hook
737  call assert_notequal('dosini', &filetype)
738  bwipe!
739
740  call delete('Xfile.hook')
741  filetype off
742endfunc
743
744func Test_ts_file()
745  filetype on
746
747  call writefile(['<?xml version="1.0" encoding="utf-8"?>'], 'Xfile.ts')
748  split Xfile.ts
749  call assert_equal('xml', &filetype)
750  bwipe!
751
752  call writefile(['// looks like Typescript'], 'Xfile.ts')
753  split Xfile.ts
754  call assert_equal('typescript', &filetype)
755  bwipe!
756
757  call delete('Xfile.ts')
758  filetype off
759endfunc
760
761func Test_ttl_file()
762  filetype on
763
764  call writefile(['@base <http://example.org/> .'], 'Xfile.ttl')
765  split Xfile.ttl
766  call assert_equal('turtle', &filetype)
767  bwipe!
768
769  call writefile(['looks like Tera Term Language'], 'Xfile.ttl')
770  split Xfile.ttl
771  call assert_equal('teraterm', &filetype)
772  bwipe!
773
774  call delete('Xfile.ttl')
775  filetype off
776endfunc
777
778func Test_pp_file()
779  filetype on
780
781  call writefile(['looks like puppet'], 'Xfile.pp')
782  split Xfile.pp
783  call assert_equal('puppet', &filetype)
784  bwipe!
785
786  let g:filetype_pp = 'pascal'
787  split Xfile.pp
788  call assert_equal('pascal', &filetype)
789  bwipe!
790  unlet g:filetype_pp
791
792  " Test dist#ft#FTpp()
793  call writefile(['{ pascal comment'], 'Xfile.pp')
794  split Xfile.pp
795  call assert_equal('pascal', &filetype)
796  bwipe!
797
798  call writefile(['procedure pascal'], 'Xfile.pp')
799  split Xfile.pp
800  call assert_equal('pascal', &filetype)
801  bwipe!
802
803  call delete('Xfile.pp')
804  filetype off
805endfunc
806
807func Test_ex_file()
808  filetype on
809
810  call writefile(['arbitrary content'], 'Xfile.ex')
811  split Xfile.ex
812  call assert_equal('elixir', &filetype)
813  bwipe!
814  let g:filetype_euphoria = 'euphoria4'
815  split Xfile.ex
816  call assert_equal('euphoria4', &filetype)
817  bwipe!
818  unlet g:filetype_euphoria
819
820  call writefile(['-- filetype euphoria comment'], 'Xfile.ex')
821  split Xfile.ex
822  call assert_equal('euphoria3', &filetype)
823  bwipe!
824
825  call writefile(['--filetype euphoria comment'], 'Xfile.ex')
826  split Xfile.ex
827  call assert_equal('euphoria3', &filetype)
828  bwipe!
829
830  call writefile(['ifdef '], 'Xfile.ex')
831  split Xfile.ex
832  call assert_equal('euphoria3', &filetype)
833  bwipe!
834
835  call writefile(['include '], 'Xfile.ex')
836  split Xfile.ex
837  call assert_equal('euphoria3', &filetype)
838  bwipe!
839
840  call delete('Xfile.ex')
841  filetype off
842endfunc
843
844func Test_dsl_file()
845  filetype on
846
847  call writefile(['  <!doctype dsssl-spec ['], 'dslfile.dsl')
848  split dslfile.dsl
849  call assert_equal('dsl', &filetype)
850  bwipe!
851
852  call writefile(['workspace {'], 'dslfile.dsl')
853  split dslfile.dsl
854  call assert_equal('structurizr', &filetype)
855  bwipe!
856
857  call delete('dslfile.dsl')
858  filetype off
859endfunc
860
861func Test_m_file()
862  filetype on
863
864  call writefile(['looks like Matlab'], 'Xfile.m')
865  split Xfile.m
866  call assert_equal('matlab', &filetype)
867  bwipe!
868
869  let g:filetype_m = 'octave'
870  split Xfile.m
871  call assert_equal('octave', &filetype)
872  bwipe!
873  unlet g:filetype_m
874
875  " Test dist#ft#FTm()
876
877  " Objective-C
878
879  call writefile(['// Objective-C line comment'], 'Xfile.m')
880  split Xfile.m
881  call assert_equal('objc', &filetype)
882  bwipe!
883
884  call writefile(['/* Objective-C block comment */'], 'Xfile.m')
885  split Xfile.m
886  call assert_equal('objc', &filetype)
887  bwipe!
888
889  call writefile(['#import "test.m"'], 'Xfile.m')
890  split Xfile.m
891  call assert_equal('objc', &filetype)
892  bwipe!
893
894  " Octave
895
896  call writefile(['# Octave line comment'], 'Xfile.m')
897  split Xfile.m
898  call assert_equal('octave', &filetype)
899  bwipe!
900
901  call writefile(['%!test "Octave test"'], 'Xfile.m')
902  split Xfile.m
903  call assert_equal('octave', &filetype)
904  bwipe!
905
906  call writefile(['unwind_protect'], 'Xfile.m')
907  split Xfile.m
908  call assert_equal('octave', &filetype)
909  bwipe!
910
911  call writefile(['try; 42; end_try_catch'], 'Xfile.m')
912  split Xfile.m
913  call assert_equal('octave', &filetype)
914  bwipe!
915
916  " Mathematica
917
918  call writefile(['(* Mathematica comment'], 'Xfile.m')
919  split Xfile.m
920  call assert_equal('mma', &filetype)
921  bwipe!
922
923  " MATLAB
924
925  call writefile(['% MATLAB line comment'], 'Xfile.m')
926  split Xfile.m
927  call assert_equal('matlab', &filetype)
928  bwipe!
929
930  " Murphi
931
932  call writefile(['-- Murphi comment'], 'Xfile.m')
933  split Xfile.m
934  call assert_equal('murphi', &filetype)
935  bwipe!
936
937  call writefile(['/* Murphi block comment */', 'Type'], 'Xfile.m')
938  split Xfile.m
939  call assert_equal('murphi', &filetype)
940  bwipe!
941
942  call writefile(['Type'], 'Xfile.m')
943  split Xfile.m
944  call assert_equal('murphi', &filetype)
945  bwipe!
946
947  call delete('Xfile.m')
948  filetype off
949endfunc
950
951func Test_xpm_file()
952  filetype on
953
954  call writefile(['this is XPM2'], 'file.xpm')
955  split file.xpm
956  call assert_equal('xpm2', &filetype)
957  bwipe!
958
959  call delete('file.xpm')
960  filetype off
961endfunc
962
963" vim: shiftwidth=2 sts=2 expandtab
964