test_filetype.vim (113897B)
1 " Test :setfiletype 2 3 " Make VIMRUNTIME and &rtp absolute. 4 " Otherwise, a :lcd inside a test would break the relative ../../runtime path. 5 let $VIMRUNTIME = fnamemodify($VIMRUNTIME, ':p') 6 let &rtp = join(map(split(&rtp, ','), 'fnamemodify(v:val, ":p")'), ',') 7 8 func Test_backup_strip() 9 filetype on 10 let fname = 'Xdetect.js~~~~~~~~~~~' 11 call writefile(['one', 'two', 'three'], fname, 'D') 12 exe 'edit ' .. fname 13 call assert_equal('javascript', &filetype) 14 15 bwipe! 16 filetype off 17 endfunc 18 19 func Test_detection() 20 filetype on 21 augroup filetypedetect 22 au BufNewFile,BufRead * call assert_equal(1, did_filetype()) 23 augroup END 24 new something.vim 25 call assert_equal('vim', &filetype) 26 27 bwipe! 28 filetype off 29 endfunc 30 31 func Test_conf_type() 32 filetype on 33 call writefile(['# some comment', 'must be conf'], 'Xconffile', 'D') 34 augroup filetypedetect 35 au BufNewFile,BufRead * call assert_equal(0, did_filetype()) 36 augroup END 37 split Xconffile 38 call assert_equal('conf', &filetype) 39 40 bwipe! 41 filetype off 42 endfunc 43 44 func Test_other_type() 45 filetype on 46 augroup filetypedetect 47 au BufNewFile,BufRead * call assert_equal(0, did_filetype()) 48 au BufNewFile,BufRead Xotherfile setf testfile 49 au BufNewFile,BufRead * call assert_equal(1, did_filetype()) 50 augroup END 51 call writefile(['# some comment', 'must be conf'], 'Xotherfile', 'D') 52 split Xotherfile 53 call assert_equal('testfile', &filetype) 54 55 bwipe! 56 filetype off 57 endfunc 58 59 " If $XDG_CONFIG_HOME is set return "fname" expanded in a list. 60 " Otherwise return an empty list. 61 func s:WhenConfigHome(fname) 62 if exists('$XDG_CONFIG_HOME') 63 return [expand(a:fname)] 64 endif 65 return [] 66 endfunc 67 68 " Return the name used for the $XDG_CONFIG_HOME directory. 69 func s:GetConfigHome() 70 return getcwd() .. '/Xdg_config_home' 71 endfunc 72 73 " saved value of $XDG_CONFIG_HOME 74 let s:saveConfigHome = '' 75 76 func s:SetupConfigHome() 77 " Nvim on Windows may use $XDG_CONFIG_HOME, and runnvim.sh sets it. 78 " if empty(windowsversion()) 79 let s:saveConfigHome = $XDG_CONFIG_HOME 80 call setenv("XDG_CONFIG_HOME", s:GetConfigHome()) 81 " endif 82 endfunc 83 84 " Filetypes detected just from matching the file name. 85 " First one is checking that these files have no filetype. 86 func s:GetFilenameChecks() abort 87 return { 88 \ 'none': ['bsd', 'some-bsd'], 89 \ '8th': ['file.8th'], 90 \ 'a2ps': ['/etc/a2ps.cfg', '/etc/a2ps/file.cfg', 'a2psrc', '.a2psrc', 'any/etc/a2ps.cfg', 'any/etc/a2ps/file.cfg'], 91 \ 'a65': ['file.a65'], 92 \ 'aap': ['file.aap'], 93 \ 'abap': ['file.abap'], 94 \ 'abc': ['file.abc'], 95 \ 'abel': ['file.abl'], 96 \ 'abnf': ['file.abnf'], 97 \ 'acedb': ['file.wrm'], 98 \ 'ada': ['file.adb', 'file.ads', 'file.ada', 'file.gpr'], 99 \ 'ahdl': ['file.tdf'], 100 \ 'aidl': ['file.aidl'], 101 \ 'alsaconf': ['.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf', 'any/etc/asound.conf', 'any/usr/share/alsa/alsa.conf'], 102 \ 'aml': ['file.aml'], 103 \ 'ampl': ['file.run'], 104 \ 'ant': ['build.xml'], 105 \ 'antlr4': ['parser.g4'], 106 \ 'apache': ['.htaccess', '/etc/httpd/file.conf', '/etc/apache2/sites-2/file.com', '/etc/apache2/some.config', '/etc/apache2/conf.file/conf', 107 \ '/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', 108 \ '/etc/apache2/file.conf-file', '/etc/apache2/mods-file/file', '/etc/apache2/sites-file/file', '/etc/apache2/sites-file/file.com', 109 \ '/etc/httpd/conf.d/file.conf', '/etc/httpd/conf.d/file.conf-file', 'access.conf', 'access.conf-file', 'any/etc/apache2/conf.file/file', 110 \ 'any/etc/apache2/file.conf', 'any/etc/apache2/file.conf-file', 'any/etc/apache2/mods-file/file', 'any/etc/apache2/sites-file/file', 111 \ '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', 112 \ 'apache.conf', 'apache.conf-file', 'apache2.conf', 'apache2.conf-file', 'httpd.conf', 'httpd.conf-file', 'httpd-some.conf', 113 \ 'httpd-some.conf-file', 'srm.conf', 'srm.conf-file', 'proxy-html.conf', 'proxy-html.conf-file', '/etc/httpd/mods-some/file', 114 \ '/etc/httpd/sites-some/file', '/etc/httpd/conf.file/conf'], 115 \ 'apachestyle': ['/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', 116 \ 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'], 117 \ 'apkbuild': ['APKBUILD'], 118 \ 'applescript': ['file.scpt', 'file.applescript'], 119 \ 'aptconf': ['apt.conf', '/.aptitude/config', 'any/.aptitude/config'], 120 \ 'arch': ['.arch-inventory', '=tagging-method'], 121 \ 'arduino': ['file.ino', 'file.pde'], 122 \ 'art': ['file.art'], 123 \ 'asciidoc': ['file.asciidoc', 'file.adoc'], 124 \ 'asm': ['file.s', 'file.S', 'file.a', 'file.A'], 125 \ 'asn': ['file.asn', 'file.asn1'], 126 \ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'], 127 \ 'astro': ['file.astro'], 128 \ 'asy': ['file.asy'], 129 \ 'atlas': ['file.atl', 'file.as'], 130 \ 'authzed': ['schema.zed'], 131 \ 'autohotkey': ['file.ahk'], 132 \ 'autoit': ['file.au3'], 133 \ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'], 134 \ 'autopkgtest': ['/debian/tests/control', 'any/debian/tests/control'], 135 \ 'ave': ['file.ave'], 136 \ 'awk': ['file.awk', 'file.gawk'], 137 \ 'b': ['file.mch', 'file.ref', 'file.imp'], 138 \ 'basic': ['file.bas', 'file.bi', 'file.bm'], 139 \ 'bass': ['file.bass'], 140 \ 'bc': ['file.bc'], 141 \ 'bdf': ['file.bdf'], 142 \ 'beancount': ['file.beancount'], 143 \ 'bib': ['file.bib'], 144 \ 'bicep': ['file.bicep'], 145 \ 'bicep-params': ['file.bicepparam'], 146 \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file', 'foobar.zone'], 147 \ 'bitbake': ['file.bb', 'file.bbappend', 'file.bbclass', 'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf', 'meta-layer/conf/distro/foo.conf', 'project-spec/configs/zynqmp-generic-xczu7ev.conf'], 148 \ 'blade': ['file.blade.php'], 149 \ 'blank': ['file.bl'], 150 \ 'blueprint': ['file.blp'], 151 \ 'bp': ['Android.bp'], 152 \ 'bpftrace': ['file.bt'], 153 \ 'brighterscript': ['file.bs'], 154 \ 'brightscript': ['file.brs'], 155 \ 'bsdl': ['file.bsd', 'file.bsdl'], 156 \ 'bst': ['file.bst'], 157 \ 'bzl': ['file.bazel', 'file.bzl', 'file.bxl', 'WORKSPACE', 'WORKSPACE.bzlmod'], 158 \ 'bzr': ['bzr_log.any', 'bzr_log.file'], 159 \ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg', 'file.mdh', 'file.epro'], 160 \ 'c3': ['file.c3', 'file.c3i', 'file.c3t'], 161 \ 'cabal': ['file.cabal'], 162 \ 'cabalconfig': ['cabal.config', expand("$HOME/.config/cabal/config")] + s:WhenConfigHome('$XDG_CONFIG_HOME/cabal/config'), 163 \ 'cabalproject': ['cabal.project', 'cabal.project.local'], 164 \ 'cairo': ['file.cairo'], 165 \ 'calendar': ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'], 166 \ 'cangjie': ['file.cj'], 167 \ 'capnp': ['file.capnp'], 168 \ 'catalog': ['catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'], 169 \ 'cdc': ['file.cdc'], 170 \ 'cdl': ['file.cdl'], 171 \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'], 172 \ 'cdrtoc': ['file.toc'], 173 \ 'cedar': ['file.cedar'], 174 \ 'cel': ['file.cel'], 175 \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'], 176 \ 'cfengine': ['cfengine.conf'], 177 \ 'cfg': ['file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'], 178 \ 'cgdbrc': ['cgdbrc'], 179 \ 'ch': ['file.chf'], 180 \ 'chaiscript': ['file.chai'], 181 \ 'chaskell': ['file.chs'], 182 \ 'chatito': ['file.chatito'], 183 \ 'chill': ['file..ch'], 184 \ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'], 185 \ 'chuck': ['file.ck'], 186 \ 'cl': ['file.eni'], 187 \ 'clean': ['file.dcl', 'file.icl'], 188 \ 'clojure': ['file.clj', 'file.cljs', 'file.cljx', 'file.cljc', 'init.trans', 'any/etc/translate-shell', '.trans'], 189 \ 'cmake': ['CMakeLists.txt', 'file.cmake', 'file.cmake.in'], 190 \ 'cmakecache': ['CMakeCache.txt'], 191 \ 'cmod': ['file.cmod'], 192 \ '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'], 193 \ 'cobol': ['file.cbl', 'file.cob'], 194 \ 'coco': ['file.atg'], 195 \ 'codeowners': ['CODEOWNERS'], 196 \ 'conaryrecipe': ['file.recipe'], 197 \ 'conf': ['auto.master', 'file.conf', 'texdoc.cnf', '.x11vncrc', '.chktexrc', '.ripgreprc', 'ripgreprc', 'file.ctags'], 198 \ 'config': ['/etc/hostname.file', 'any/etc/hostname.file', 'configure.in', 'configure.ac', 'file.at', 'aclocal.m4'], 199 \ 'confini': ['pacman.conf', 'paru.conf', 'mpv.conf', 'any/.aws/config', 'any/.aws/credentials', 'any/.aws/cli/alias', 'file.nmconnection', 200 \ 'any/.gnuradio/grc.conf', 'any/gnuradio/config.conf', 'any/gnuradio/conf.d/modtool.conf'], 201 \ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'], 202 \ 'cook': ['file.cook'], 203 \ 'corn': ['file.corn'], 204 \ 'cpon': ['file.cpon'], 205 \ 'cpp': ['file.cxx', 'file.c++', 'file.hh', 'file.hxx', 'file.hpp', 'file.ipp', 'file.ixx', 'file.moc', 'file.tcc', 'file.inl', 'file.tlh', 'file.cppm', 'file.ccm', 'file.cxxm', 'file.c++m', 'file.mpp'], 206 \ 'cqlang': ['file.cql'], 207 \ 'crm': ['file.crm'], 208 \ 'crontab': ['crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'], 209 \ 'crystal': ['file.cr'], 210 \ 'cs': ['file.cs', 'file.csx', 'file.cake'], 211 \ 'csc': ['file.csc'], 212 \ 'csdl': ['file.csdl'], 213 \ 'csp': ['file.csp', 'file.fdr'], 214 \ 'css': ['file.css'], 215 \ 'csv': ['file.csv'], 216 \ 'cterm': ['file.con'], 217 \ 'cucumber': ['file.feature'], 218 \ 'cuda': ['file.cu', 'file.cuh'], 219 \ 'cue': ['file.cue'], 220 \ 'cupl': ['file.pld'], 221 \ 'cuplsim': ['file.si'], 222 \ 'cvs': ['cvs123'], 223 \ 'cvsrc': ['.cvsrc'], 224 \ 'cynpp': ['file.cyn'], 225 \ 'cypher': ['file.cypher'], 226 \ 'd': ['file.d'], 227 \ 'dafny': ['file.dfy'], 228 \ 'dart': ['file.dart', 'file.drt'], 229 \ 'datascript': ['file.ds'], 230 \ 'dax': ['file.dax'], 231 \ 'dcd': ['file.dcd'], 232 \ 'deb822sources': ['/etc/apt/sources.list.d/file.sources', 'any/etc/apt/sources.list.d/file.sources'], 233 \ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'], 234 \ 'debcontrol': ['/debian/control', 'any/debian/control', 'any/DEBIAN/control'], 235 \ 'debcopyright': ['/debian/copyright', 'any/debian/copyright'], 236 \ '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'], 237 \ 'def': ['file.def'], 238 \ 'denyhosts': ['denyhosts.conf'], 239 \ 'desc': ['file.desc'], 240 \ 'desktop': ['file.desktop', '.directory', 'file.directory'], 241 \ 'dhall': ['file.dhall'], 242 \ 'dictconf': ['dict.conf', '.dictrc'], 243 \ 'dictdconf': ['dictd.conf', 'dictdfile.conf', 'dictd-file.conf'], 244 \ 'diff': ['file.diff', 'file.rej'], 245 \ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'], 246 \ 'djot': ['file.dj', 'file.djot'], 247 \ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'], 248 \ 'dockerfile': ['Containerfile', 'Dockerfile', 'dockerfile', 'file.Dockerfile', 'file.dockerfile', 'Dockerfile.debian', 'Containerfile.something'], 249 \ 'dosbatch': ['file.bat'], 250 \ 'dosini': ['/etc/yum.conf', '/etc/nfs.conf', '/etc/nfsmount.conf', 'file.ini', 251 \ 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', 'php-fpm.conf', 'php-fpm.conf.default', 'www.conf', 'www.conf.default', 252 \ '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap', 253 \ 'file.vbp', 'ja2.ini', 'JA2.INI', 'mimeapps.list', 'pip.conf', 'setup.cfg', 'pudb.cfg', 254 \ '.coveragerc', '.pypirc', '.gitlint', '.oelint.cfg', 'pylintrc', '.pylintrc', 255 \ '/home/user/.config/bpython/config', '/home/user/.config/mypy/config', '.wakatime.cfg', '.replyrc', 256 \ 'psprint.conf', 'sofficerc', 'any/.config/lxqt/globalkeyshortcuts.conf', 'any/.config/screengrab/screengrab.conf', 257 \ 'any/.local/share/flatpak/repo/config', 258 \ '.alsoftrc', 'alsoft.conf', 'alsoft.ini', 'alsoftrc.sample', 259 \ '.notmuch-config', '.notmuch-config.myprofile', 260 \ '~/.config/notmuch/myprofile/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/notmuch/myprofile/config'), 261 \ 'dot': ['file.dot', 'file.gv'], 262 \ 'dracula': ['file.drac', 'file.drc', 'file.lvs', 'file.lpe', 'drac.file'], 263 \ 'dtd': ['file.dtd'], 264 \ 'dtrace': ['/usr/lib/dtrace/io.d'], 265 \ 'dts': ['file.dts', 'file.dtsi', 'file.dtso', 'file.its', 'file.keymap', 'file.overlay'], 266 \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace', 'dune-file'], 267 \ 'dylan': ['file.dylan'], 268 \ 'dylanintr': ['file.intr'], 269 \ 'dylanlid': ['file.lid'], 270 \ 'earthfile': ['Earthfile'], 271 \ 'ecd': ['file.ecd'], 272 \ 'edif': ['file.edf', 'file.edif', 'file.edo'], 273 \ 'editorconfig': ['.editorconfig'], 274 \ 'eelixir': ['file.eex', 'file.leex'], 275 \ 'elinks': ['elinks.conf'], 276 \ 'elixir': ['file.ex', 'file.exs', 'mix.lock'], 277 \ 'elm': ['file.elm'], 278 \ 'elmfilt': ['filter-rules'], 279 \ 'elsa': ['file.lc'], 280 \ 'elvish': ['file.elv'], 281 \ 'env': ['.env', '.env.file', 'file.env'], 282 \ 'epuppet': ['file.epp'], 283 \ 'erlang': ['file.erl', 'file.hrl', 'file.yaws', 'file.app.src', 'rebar.config'], 284 \ 'eruby': ['file.erb', 'file.rhtml'], 285 \ 'esdl': ['file.esdl'], 286 \ 'esmtprc': ['anyesmtprc', 'esmtprc', 'some-esmtprc'], 287 \ 'esqlc': ['file.ec', 'file.EC'], 288 \ 'esterel': ['file.strl'], 289 \ 'eterm': ['anyEterm/file.cfg', 'Eterm/file.cfg', 'some-Eterm/file.cfg'], 290 \ 'execline': ['/etc/s6-rc/run', './s6-rc/src/dbus-srv/up', '/sbin/s6-shutdown'], 291 \ 'exim': ['exim.conf'], 292 \ 'expect': ['file.exp'], 293 \ 'exports': ['exports'], 294 \ 'factor': ['file.factor'], 295 \ 'falcon': ['file.fal'], 296 \ 'fan': ['file.fan', 'file.fwt'], 297 \ 'faust': ['file.dsp', 'file.lib'], 298 \ 'fennel': ['file.fnl', '.fennelrc', 'fennelrc', 'file.fnlm'], 299 \ 'fetchmail': ['.fetchmailrc'], 300 \ 'fga': ['file.fga'], 301 \ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'], 302 \ 'firrtl': ['file.fir'], 303 \ 'fish': ['file.fish'], 304 \ 'flix': ['file.flix'], 305 \ 'fluent': ['file.ftl'], 306 \ 'focexec': ['file.fex', 'file.focexec'], 307 \ 'form': ['file.frm'], 308 \ 'forth': ['file.ft', 'file.fth', 'file.4th'], 309 \ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'], 310 \ 'fpcmake': ['file.fpc'], 311 \ 'framescript': ['file.fsl'], 312 \ 'freebasic': ['file.fb'], 313 \ 'fsh': ['file.fsh'], 314 \ 'fsharp': ['file.fs', 'file.fsi', 'file.fsx'], 315 \ 'fstab': ['fstab', 'mtab'], 316 \ 'func': ['file.fc'], 317 \ 'fusion': ['file.fusion'], 318 \ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file', '.fvwmrc', 'foo.fvwmrc', 'fvwmrc.foo', '.fvwm2rc', 'foo.fvwm2rc', 'fvwm2rc.foo', 'foo.fvwm95.hook', 'fvwm95.foo.hook'], 319 \ 'fvwm2m4': ['.fvwm2rc.m4', 'foo.fvwm2rc.m4', 'fvwm2rc.foo.m4'], 320 \ 'gdb': ['.gdbinit', 'gdbinit', '.cuda-gdbinit', 'cuda-gdbinit', 'file.gdb', '.config/gdbearlyinit', '.gdbearlyinit'], 321 \ 'gdmo': ['file.mo', 'file.gdmo'], 322 \ 'gdresource': ['file.tscn', 'file.tres'], 323 \ 'gdscript': ['file.gd'], 324 \ 'gdshader': ['file.gdshader', 'file.shader'], 325 \ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'], 326 \ 'gel': ['file.gel'], 327 \ 'gemtext': ['file.gmi', 'file.gemini'], 328 \ 'gift': ['file.gift'], 329 \ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'), 330 \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'], 331 \ 'gitconfig': ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/config'), 332 \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore', '.fdignore', '/.config/fd/ignore', '.ignore', '.rgignore', '.dockerignore', '.containerignore', '.npmignore', '.vscodeignore'], 333 \ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'], 334 \ 'gitrebase': ['git-rebase-todo'], 335 \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], 336 \ 'gkrellmrc': ['gkrellmrc', 'gkrellmrc_x'], 337 \ 'gleam': ['file.gleam'], 338 \ 'glsl': ['file.glsl', 'file.vert', 'file.tesc', 'file.tese', 'file.geom', 'file.frag', 'file.comp', 'file.rgen', 'file.rmiss', 'file.rchit', 'file.rahit', 'file.rint', 'file.rcall'], 339 \ 'gn': ['file.gn', 'file.gni'], 340 \ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'], 341 \ 'gnuplot': ['file.gpi', '.gnuplot', 'file.gnuplot', '.gnuplot_history'], 342 \ 'go': ['file.go'], 343 \ 'goaccess': ['goaccess.conf'], 344 \ 'gomod': ['go.mod'], 345 \ 'gosum': ['go.sum', 'go.work.sum'], 346 \ 'gowork': ['go.work'], 347 \ 'gp': ['file.gp', '.gprc'], 348 \ 'gpg': ['/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel', 'any/.gnupg/gpg.conf', 'any/.gnupg/options', 'any/usr/any/gnupg/options.skel'], 349 \ 'grads': ['file.gs'], 350 \ 'graphql': ['file.graphql', 'file.graphqls', 'file.gql'], 351 \ 'gretl': ['file.gretl'], 352 \ 'groff': ['file.groff', 'file.mom'], 353 \ 'groovy': ['file.gradle', 'file.groovy', 'Jenkinsfile'], 354 \ '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'], 355 \ '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'], 356 \ 'gsp': ['file.gsp'], 357 \ 'gtkrc': ['.gtkrc', 'gtkrc', '.gtkrc-file', 'gtkrc-file'], 358 \ 'gyp': ['file.gyp', 'file.gypi'], 359 \ 'hack': ['file.hack', 'file.hackpartial'], 360 \ 'haml': ['file.haml'], 361 \ 'hamster': ['file.hsm'], 362 \ 'handlebars': ['file.hbs'], 363 \ 'hare': ['file.ha'], 364 \ 'haskell': ['file.hs', 'file.hsc', 'file.hs-boot', 'file.hsig'], 365 \ 'haskellpersistent': ['file.persistentmodels'], 366 \ 'haste': ['file.ht'], 367 \ 'hastepreproc': ['file.htpp'], 368 \ 'haxe': ['file.hx'], 369 \ 'hb': ['file.hb'], 370 \ 'hcl': ['file.hcl'], 371 \ 'heex': ['file.heex'], 372 \ 'hercules': ['file.vc', 'file.ev', 'file.sum', 'file.errsum'], 373 \ 'hex': ['file.hex', 'file.ihex', 'file.ihe', 'file.ihx', 'file.int', 'file.mcs', 'file.h32', 'file.h80', 'file.h86', 'file.a43', 'file.a90'], 374 \ 'hgcommit': ['hg-editor-file.txt'], 375 \ 'hjson': ['file.hjson'], 376 \ 'hlsplaylist': ['file.m3u', 'file.m3u8'], 377 \ 'hog': ['file.hog', 'snort.conf', 'vision.conf'], 378 \ 'hollywood': ['file.hws'], 379 \ 'hoon': ['file.hoon'], 380 \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'], 381 \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'], 382 \ 'html': ['file.html', 'file.htm', 'file.component.html'], 383 \ 'htmlm4': ['file.html.m4'], 384 \ 'httest': ['file.htt', 'file.htb'], 385 \ 'http': ['file.http'], 386 \ 'hurl': ['file.hurl'], 387 \ 'hy': ['file.hy', '.hy-history'], 388 \ 'hylo': ['file.hylo'], 389 \ 'hyprlang': ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'], 390 \ 'i3config': ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'], 391 \ 'ibasic': ['file.iba', 'file.ibi'], 392 \ 'icemenu': ['/.icewm/menu', 'any/.icewm/menu'], 393 \ 'icon': ['file.icn'], 394 \ 'idris2': ['file.idr'], 395 \ 'indent': ['.indent.pro', 'indentrc'], 396 \ 'inform': ['file.inf', 'file.INF'], 397 \ 'initng': ['/etc/initng/any/file.i', 'file.ii', 'any/etc/initng/any/file.i'], 398 \ 'inittab': ['inittab'], 399 \ 'inko': ['file.inko'], 400 \ 'ipfilter': ['ipf.conf', 'ipf6.conf', 'ipf.rules'], 401 \ 'ipkg': ['file.ipkg'], 402 \ 'iss': ['file.iss'], 403 \ 'ist': ['file.ist', 'file.mst'], 404 \ 'j': ['file.ijs'], 405 \ 'jal': ['file.jal', 'file.JAL'], 406 \ 'jam': ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'], 407 \ 'janet': ['file.janet'], 408 \ 'java': ['file.java', 'file.jav', 'file.jsh'], 409 \ 'javacc': ['file.jj', 'file.jjt'], 410 \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs', '.node_repl_history', '.bun_repl_history', 'deno_history.txt'], 411 \ 'javascript.glimmer': ['file.gjs'], 412 \ 'javascriptreact': ['file.jsx'], 413 \ 'jess': ['file.clp'], 414 \ 'jgraph': ['file.jgr'], 415 \ 'jinja': ['file.jinja'], 416 \ 'jjdescription': ['file.jjdescription'], 417 \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], 418 \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], 419 \ 'jq': ['file.jq'], 420 \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock', '.swcrc', 'composer.lock', 'symfony.lock'], 421 \ 'json5': ['file.json5'], 422 \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc', 'bun.lock', expand("$HOME/.config/VSCodium/User/settings.json"), '/home/user/.config/waybar/config'], 423 \ 'jsonl': ['file.jsonl'], 424 \ 'jsonnet': ['file.jsonnet', 'file.libsonnet'], 425 \ 'jsp': ['file.jsp'], 426 \ 'julia': ['file.jl'], 427 \ 'just': ['justfile', 'Justfile', '.justfile', 'config.just'], 428 \ 'karel': ['file.kl', 'file.KL'], 429 \ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file', 'Config.in', 'Config.in.host'], 430 \ 'kdl': ['file.kdl'], 431 \ 'kerml': ['file.kerml'], 432 \ 'kitty': ['kitty.conf', '~/.config/kitty/colorscheme.conf'], 433 \ 'kivy': ['file.kv'], 434 \ 'kix': ['file.kix'], 435 \ 'koka': ['file.kk'], 436 \ 'kos': ['file.kos'], 437 \ 'kotlin': ['file.kt', 'file.ktm', 'file.kts'], 438 \ 'krl': ['file.sub', 'file.Sub', 'file.SUB'], 439 \ 'kscript': ['file.ks'], 440 \ 'kwt': ['file.k'], 441 \ 'lace': ['file.ace', 'file.ACE'], 442 \ 'lalrpop': ['file.lalrpop'], 443 \ 'latte': ['file.latte', 'file.lte'], 444 \ 'ld': ['file.ld', 'any/usr/lib/aarch64-xilinx-linux/ldscripts/aarch64elf32b.x'], 445 \ 'ldapconf': ['ldap.conf', '.ldaprc', 'ldaprc'], 446 \ 'ldif': ['file.ldif'], 447 \ 'lean': ['file.lean'], 448 \ 'ledger': ['file.ldg', 'file.ledger', 'file.journal'], 449 \ 'leex': ['file.xrl'], 450 \ 'leo': ['file.leo'], 451 \ 'less': ['file.less'], 452 \ 'lex': ['file.lex', 'file.l', 'file.lxx', 'file.l++'], 453 \ 'lf': ['lfrc'], 454 \ 'lftp': ['lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'], 455 \ 'lhaskell': ['file.lhs'], 456 \ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'], 457 \ 'lidris2': ['file.lidr'], 458 \ 'lifelines': ['file.ll'], 459 \ 'lilo': ['lilo.conf', 'lilo.conf-file'], 460 \ 'lilypond': ['file.ly', 'file.ily'], 461 \ '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'], 462 \ 'liquid': ['file.liquid'], 463 \ 'liquidsoap': ['file.liq'], 464 \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'], 465 \ 'lite': ['file.lite', 'file.lt'], 466 \ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'], 467 \ 'livebook': ['file.livemd'], 468 "\ 'log': ['file.log', 'file_log', 'file.LOG', 'file_LOG'], 469 \ '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'], 470 \ 'loginaccess': ['/etc/login.access', 'any/etc/login.access'], 471 \ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'], 472 \ 'logtalk': ['file.lgt'], 473 \ 'lotos': ['file.lot', 'file.lotos'], 474 \ 'lout': ['file.lou', 'file.lout'], 475 \ 'lpc': ['file.lpc', 'file.ulpc'], 476 \ 'lsl': ['file.lsl'], 477 \ 'lss': ['file.lss'], 478 \ 'lua': ['file.lua', 'file.tlu', 'file.rockspec', 'file.nse', '.lua_history', '.luacheckrc', '.busted', 'rock_manifest', 'config.ld'], 479 \ 'luau': ['file.luau'], 480 \ 'lynx': ['lynx.cfg'], 481 \ 'lyrics': ['file.lrc'], 482 \ 'm17ndb': ['any/m17n/file.ali', 'any/m17n/file.cs', 'any/m17n/file.dir', 'any/m17n/file.flt', 'any/m17n/file.fst', 'any/m17n/file.lnm', 'any/m17n/file.mic', 'any/m17n/file.mim', 'any/m17n/file.tbl', 483 \ 'any/.m17n.d/file.ali', 'any/.m17n.d/file.cs', 'any/.m17n.d/file.dir', 'any/.m17n.d/file.flt', 'any/.m17n.d/file.fst', 'any/.m17n.d/file.lnm', 'any/.m17n.d/file.mic', 'any/.m17n.d/file.mim', 'any/.m17n.d/file.tbl', 484 \ 'any/m17n-db/file.ali', 'any/m17n-db/file.cs', 'any/m17n-db/file.dir', 'any/m17n-db/FLT/file.flt', 'any/m17n-db/file.fst', 'any/m17n-db/LANGDATA/file.lnm', 'any/m17n-db/file.mic', 'any/m17n-db/MIM/file.mim', 'any/m17n-db/file.tbl'], 485 \ 'm3build': ['m3makefile', 'm3overrides'], 486 \ 'm3quake': ['file.quake', 'cm3.cfg'], 487 \ 'm4': ['.m4_history'], 488 \ 'mail': ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'], 489 \ 'mailaliases': ['/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'], 490 \ 'mailcap': ['.mailcap', 'mailcap'], 491 \ 'make': ['file.mk', 'file.mak', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile', 'Kbuild'], 492 \ 'mallard': ['file.page'], 493 "\ 'man': ['file.man'], 494 \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'], 495 \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], 496 \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'], 497 \ 'masm': ['file.masm'], 498 \ 'mason': ['file.mason', 'file.mhtml'], 499 \ 'master': ['file.mas', 'file.master'], 500 \ 'matlab': ['file.m'], 501 \ 'maxima': ['file.demo', 'file.dmt', 'file.dm1', 'file.dm2', 'file.dm3', 502 \ 'file.wxm', 'maxima-init.mac'], 503 \ 'mbsync': ['.mbsyncrc', 'file.mbsyncrc', 'isyncrc'], 504 \ 'mediawiki': ['file.mw', 'file.wiki'], 505 \ 'mel': ['file.mel'], 506 \ 'mermaid': ['file.mmd', 'file.mmdc', 'file.mermaid'], 507 \ 'meson': ['meson.build', 'meson.options', 'meson_options.txt'], 508 \ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', 509 \ '/log/kern', '/log/lpr', '/log/mail', '/log/messages', 510 \ '/log/news/news', '/log/syslog', '/log/user', '/log/auth.log', 511 \ '/log/cron.log', '/log/daemon.log', '/log/debug.log', 512 \ '/log/kern.log', '/log/lpr.log', '/log/mail.log', 513 \ '/log/messages.log', '/log/news/news.log', '/log/syslog.log', 514 \ '/log/user.log', '/log/auth.err', '/log/cron.err', 515 \ '/log/daemon.err', '/log/debug.err', '/log/kern.err', 516 \ '/log/lpr.err', '/log/mail.err', '/log/messages.err', 517 \ '/log/news/news.err', '/log/syslog.err', '/log/user.err', 518 \ '/log/auth.info', '/log/cron.info', '/log/daemon.info', 519 \ '/log/debug.info', '/log/kern.info', '/log/lpr.info', 520 \ '/log/mail.info', '/log/messages.info', '/log/news/news.info', 521 \ '/log/syslog.info', '/log/user.info', '/log/auth.warn', 522 \ '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', 523 \ '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', 524 \ '/log/messages.warn', '/log/news/news.warn', 525 \ '/log/syslog.warn', '/log/user.warn', '/log/auth.crit', 526 \ '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', 527 \ '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', 528 \ '/log/messages.crit', '/log/news/news.crit', 529 \ '/log/syslog.crit', '/log/user.crit', '/log/auth.notice', 530 \ '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', 531 \ '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', 532 \ '/log/messages.notice', '/log/news/news.notice', 533 \ '/log/syslog.notice', '/log/user.notice'], 534 \ 'mf': ['file.mf'], 535 \ 'mgl': ['file.mgl'], 536 \ 'mgp': ['file.mgp'], 537 \ 'mib': ['file.mib', 'file.my'], 538 \ 'mix': ['file.mix', 'file.mixal'], 539 \ 'mlir': ['file.mlir'], 540 \ 'mma': ['file.nb', 'file.wl'], 541 \ 'mmp': ['file.mmp'], 542 \ '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'], 543 \ 'modula3': ['file.m3', 'file.mg', 'file.i3', 'file.ig', 'file.lm3'], 544 \ 'mojo': ['file.mojo', 'file.🔥'], 545 \ 'monk': ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'], 546 \ 'moo': ['file.moo'], 547 \ 'moonscript': ['file.moon'], 548 \ 'move': ['file.move'], 549 \ 'mp': ['file.mp', 'file.mpxl', 'file.mpiv', 'file.mpvi'], 550 \ 'mplayerconf': ['mplayer.conf', '/.mplayer/config', 'any/.mplayer/config'], 551 \ 'mrxvtrc': ['mrxvtrc', '.mrxvtrc'], 552 \ 'msidl': ['file.odl', 'file.mof'], 553 \ 'msmtp': ['.msmtprc'], 554 \ 'msql': ['file.msql'], 555 \ 'mss': ['file.mss'], 556 \ 'mupad': ['file.mu'], 557 \ 'mush': ['file.mush'], 558 \ 'mustache': ['file.mustache'], 559 \ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', 560 \ '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', 561 \ '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', 562 \ '/.muttng/muttngrc-file', '/.muttng/muttrc', 563 \ '/.muttng/muttrc-file', '/etc/Muttrc.d/file', 564 \ '/etc/Muttrc.d/file.rc', 'Muttngrc-file', 'Muttrc-file', 565 \ 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 566 \ 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 567 \ 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 568 \ 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 569 \ 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 570 \ 'muttrc-file'], 571 \ 'mysql': ['file.mysql', '.mysql_history'], 572 \ 'n1ql': ['file.n1ql', 'file.nql'], 573 \ 'named': ['namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'], 574 \ 'nanorc': ['/etc/nanorc', 'file.nanorc', 'any/etc/nanorc'], 575 \ 'nasm': ['file.nasm'], 576 \ 'natural': ['file.NSA', 'file.NSC', 'file.NSG', 'file.NSL', 'file.NSM', 'file.NSN', 'file.NSP', 'file.NSS'], 577 \ 'ncf': ['file.ncf'], 578 \ 'neomuttlog': ['/home/user/.neomuttdebug1'], 579 \ 'neomuttrc': ['Neomuttrc', '.neomuttrc', '.neomuttrc-file', '/.neomutt/neomuttrc', '/.neomutt/neomuttrc-file', 'Neomuttrc', 'Neomuttrc-file', 'any/.neomutt/neomuttrc', 'any/.neomutt/neomuttrc-file', 'neomuttrc', 'neomuttrc-file'], 580 \ 'neon': ['file.neon'], 581 \ 'netlinx': ['file.axs', 'file.axi'], 582 \ 'netrc': ['.netrc'], 583 \ 'nginx': ['file.nginx', 'nginxfile.conf', 'filenginx.conf', 'any/etc/nginx/file', 'any/usr/local/nginx/conf/file', 'any/nginx/file.conf'], 584 \ 'nickel': ['file.ncl'], 585 \ 'nim': ['file.nim', 'file.nims', 'file.nimble'], 586 \ 'ninja': ['file.ninja'], 587 \ 'nix': ['file.nix'], 588 \ 'norg': ['file.norg'], 589 \ 'nq': ['file.nq'], 590 \ 'nqc': ['file.nqc'], 591 \ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'tmac.file'], 592 \ 'nsis': ['file.nsi', 'file.nsh'], 593 \ 'ntriples': ['file.nt'], 594 \ 'nu': ['file.nu'], 595 \ 'numbat': ['file.nbt'], 596 \ 'obj': ['file.obj'], 597 \ 'objdump': ['file.objdump', 'file.cppobjdump'], 598 \ 'obse': ['file.obl', 'file.obse', 'file.oblivion', 'file.obscript'], 599 \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'], 600 \ 'occam': ['file.occ'], 601 \ 'octave': ['octaverc', '.octaverc', 'octave.conf', 'any/.local/share/octave/history'], 602 \ 'odin': ['file.odin'], 603 \ 'omnimark': ['file.xom', 'file.xin'], 604 \ 'ondir': ['.ondirrc'], 605 \ 'opam': ['opam', 'file.opam', 'file.opam.template', 'opam.locked', 'file.opam.locked'], 606 \ 'openroad': ['file.or'], 607 \ 'openscad': ['file.scad'], 608 \ 'openvpn': ['file.ovpn', '/etc/openvpn/client/client.conf', '/usr/share/openvpn/examples/server.conf'], 609 \ 'opl': ['file.OPL', 'file.OPl', 'file.OpL', 'file.Opl', 'file.oPL', 'file.oPl', 'file.opL', 'file.opl'], 610 \ 'ora': ['file.ora'], 611 \ 'org': ['file.org', 'file.org_archive'], 612 \ 'pamconf': ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'], 613 \ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'], 614 \ 'pandoc': ['file.pandoc', 'file.pdk', 'file.pd', 'file.pdc'], 615 \ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'], 616 \ 'pascal': ['file.pas', 'file.dpr', 'file.lpr'], 617 \ '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'], 618 \ 'pbtxt': ['file.txtpb', 'file.textproto', 'file.textpb', 'file.pbtxt', 'file.aconfig'], 619 \ 'pccts': ['file.g'], 620 \ 'pcmk': ['file.pcmk'], 621 \ 'pdf': ['file.pdf'], 622 \ 'pem': ['file.pem', 'file.cer', 'file.crt', 'file.csr'], 623 \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc', '.latexmkrc', 'latexmkrc'], 624 \ 'pf': ['pf.conf'], 625 \ 'pfmain': ['main.cf', 'main.cf.proto'], 626 \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'], 627 \ 'pike': ['file.pike', 'file.pmod'], 628 \ 'pilrc': ['file.rcp'], 629 \ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'], 630 \ 'pinfo': ['/etc/pinforc', '/.pinforc', 'any/.pinforc', 'any/etc/pinforc'], 631 \ 'pkl': ['file.pkl', 'file.pcf'], 632 \ 'pli': ['file.pli', 'file.pl1'], 633 \ 'plm': ['file.plm', 'file.p36', 'file.pac'], 634 \ 'plp': ['file.plp'], 635 \ 'plsql': ['file.pls', 'file.plsql'], 636 \ 'po': ['file.po', 'file.pot'], 637 \ 'pod': ['file.pod'], 638 \ 'poefilter': ['file.filter'], 639 \ 'poke': ['file.pk'], 640 \ 'pony': ['file.pony'], 641 \ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'], 642 \ 'pov': ['file.pov'], 643 \ 'povini': ['.povrayrc'], 644 \ 'ppd': ['file.ppd'], 645 \ 'ppwiz': ['file.it', 'file.ih'], 646 \ 'pq': ['file.pq'], 647 \ 'prisma': ['file.prisma'], 648 \ 'privoxy': ['file.action'], 649 \ 'proc': ['file.pc'], 650 \ 'procmail': ['.procmail', '.procmailrc'], 651 \ 'prolog': ['file.pdb'], 652 \ 'promela': ['file.pml'], 653 \ 'proto': ['file.proto'], 654 \ 'protocols': ['/etc/protocols', 'any/etc/protocols'], 655 \ 'prql': ['file.prql'], 656 \ 'ps1': ['file.ps1', 'file.psd1', 'file.psm1', 'file.pssc'], 657 \ 'ps1xml': ['file.ps1xml'], 658 \ 'psf': ['file.psf'], 659 \ 'psl': ['file.psl'], 660 \ 'ptx': ['file.ptx'], 661 \ 'pug': ['file.pug'], 662 \ 'puppet': ['file.pp'], 663 \ 'purescript': ['file.purs'], 664 \ 'pymanifest': ['MANIFEST.in'], 665 \ 'pyret': ['file.arr'], 666 \ 'pyrex': ['file.pyx', 'file.pxd', 'file.pxi', 'file.pyx+'], 667 \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', '.python_history', '.jline-jython.history', 'file.ptl', 'file.pyi', 'SConstruct', 'file.ipy'], 668 \ 'ql': ['file.ql', 'file.qll'], 669 \ 'qml': ['file.qml', 'file.qbs'], 670 \ 'qmldir': ['qmldir'], 671 \ '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'], 672 \ 'quarto': ['file.qmd'], 673 \ 'quickbms': ['file.bms'], 674 \ 'r': ['file.r', '.Rhistory', '.Rprofile', 'Rprofile', 'Rprofile.site'], 675 \ 'racket': ['file.rkt', 'file.rktd', 'file.rktl'], 676 \ 'radiance': ['file.rad', 'file.mat'], 677 \ 'raku': ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'], 678 \ 'raml': ['file.raml'], 679 \ 'rapid': ['file.sysx', 'file.Sysx', 'file.SysX', 'file.SYSx', 'file.SYSX', 'file.modx', 'file.Modx', 'file.ModX', 'file.MODx', 'file.MODX'], 680 \ 'rasi': ['file.rasi', 'file.rasinc'], 681 \ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'], 682 \ 'razor': ['file.cshtml', 'file.razor'], 683 \ 'rbs': ['file.rbs'], 684 \ 'rc': ['file.rc', 'file.rch'], 685 \ 'rcs': ['file,v'], 686 \ 'readline': ['.inputrc', 'inputrc'], 687 \ 'rego': ['file.rego'], 688 \ 'remind': ['.reminders', 'file.remind', 'file.rem', '.reminders-file'], 689 \ 'requirements': ['file.pip', 'requirements.txt', 'dev-requirements.txt', 'requirements-dev.txt', 'constraints.txt', 'requirements.in', 'requirements/dev.txt', 'requires/dev.txt'], 690 \ 'rescript': ['file.res', 'file.resi'], 691 \ 'resolv': ['resolv.conf'], 692 \ 'reva': ['file.frt'], 693 \ 'rexx': ['file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'], 694 \ 'rhelp': ['file.rd'], 695 \ 'rib': ['file.rib'], 696 \ 'rmd': ['file.rmd', 'file.smd'], 697 \ 'rnc': ['file.rnc'], 698 \ 'rng': ['file.rng'], 699 \ 'rnoweb': ['file.rnw', 'file.snw'], 700 \ 'robot': ['file.robot', 'file.resource'], 701 \ 'robots': ['robots.txt'], 702 \ 'roc': ['file.roc'], 703 \ 'ron': ['file.ron'], 704 \ 'routeros': ['file.rsc'], 705 \ 'rpcgen': ['file.x'], 706 \ 'rpgle': ['file.rpgle', 'file.rpgleinc'], 707 \ 'rpl': ['file.rpl'], 708 \ 'rrst': ['file.rrst', 'file.srst'], 709 \ 'rst': ['file.rst'], 710 \ 'rtf': ['file.rtf'], 711 \ 'ruby': ['.irbrc', 'irbrc', '.irb_history', 'irb_history', 'file.rb', 'file.rbi', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 712 \ 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 713 \ 'Puppetfile', 'Vagrantfile', 'Brewfile'], 714 \ 'rust': ['file.rs'], 715 \ 'sage': ['file.sage'], 716 \ 'salt': ['file.sls'], 717 \ 'samba': ['smb.conf'], 718 \ 'sas': ['file.sas'], 719 \ 'sass': ['file.sass'], 720 \ 'sbt': ['file.sbt'], 721 \ 'scala': ['file.scala', 'file.mill'], 722 \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config', '.lips_repl_history', '.guile'], 723 \ 'scilab': ['file.sci', 'file.sce'], 724 \ 'screen': ['.screenrc', 'screenrc'], 725 \ 'scss': ['file.scss'], 726 \ 'sd': ['file.sd'], 727 \ 'sdc': ['file.sdc'], 728 \ 'sdl': ['file.sdl', 'file.pr'], 729 \ 'sed': ['file.sed'], 730 \ 'sensors': ['/etc/sensors.conf', '/etc/sensors3.conf', '/etc/sensors.d/file', 'any/etc/sensors.conf', 'any/etc/sensors3.conf', 'any/etc/sensors.d/file'], 731 \ 'services': ['/etc/services', 'any/etc/services'], 732 \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'], 733 \ 'sexplib': ['file.sexp'], 734 \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', 735 \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', 736 \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 737 \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.envrc', '.envrc.file', 'file.envrc', 'devscripts.conf', 738 \ '.devscripts', 'file.lo', 'file.la', 'file.lai'], 739 \ 'shaderslang': ['file.slang'], 740 \ 'sieve': ['file.siv', 'file.sieve'], 741 \ 'sil': ['file.sil'], 742 \ 'simula': ['file.sim'], 743 \ 'sinda': ['file.sin', 'file.s85'], 744 \ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'], 745 \ 'skhd': ['.skhdrc', 'skhdrc'], 746 \ 'skill': ['file.il', 'file.ils', 'file.cdf'], 747 \ 'slang': ['file.sl'], 748 \ 'slice': ['file.ice'], 749 \ 'slint': ['file.slint'], 750 \ 'slpconf': ['/etc/slp.conf', 'any/etc/slp.conf'], 751 \ 'slpreg': ['/etc/slp.reg', 'any/etc/slp.reg'], 752 \ 'slpspi': ['/etc/slp.spi', 'any/etc/slp.spi'], 753 \ 'slrnrc': ['.slrnrc'], 754 \ 'slrnsc': ['file.score'], 755 \ 'sm': ['sendmail.cf'], 756 \ 'smali': ['file.smali'], 757 \ 'smarty': ['file.tpl'], 758 \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'], 759 \ 'smith': ['file.smt', 'file.smith'], 760 \ 'smithy': ['file.smithy'], 761 \ 'sml': ['file.sml'], 762 \ 'snakemake': ['file.smk', 'Snakefile'], 763 \ 'snobol4': ['file.sno', 'file.spt'], 764 \ 'solidity': ['file.sol'], 765 \ 'solution': ['file.sln'], 766 \ 'soy': ['file.soy'], 767 \ 'spajson': ['any/pipewire/file.conf', 'any/pipewire/file.conf.d/other.conf', 768 \ 'any/wireplumber/file.conf', 'any/wireplumber/file.conf.d/other.conf'], 769 \ 'sparql': ['file.rq', 'file.sparql'], 770 \ 'spec': ['file.spec'], 771 \ 'spice': ['file.sp', 'file.spice'], 772 \ 'spup': ['file.speedup', 'file.spdata', 'file.spd'], 773 \ 'spyce': ['file.spy', 'file.spi'], 774 \ 'sql': ['file.tyb', 'file.tyc', 'file.pkb', 'file.pks', '.sqlite_history'], 775 \ 'sqlj': ['file.sqlj'], 776 \ 'sqr': ['file.sqr', 'file.sqi'], 777 \ 'squid': ['squid.conf'], 778 \ 'squirrel': ['file.nut'], 779 \ 'srec': ['file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'], 780 \ 'srt': ['file.srt'], 781 \ 'ssa': ['file.ass', 'file.ssa'], 782 \ 'sshconfig': ['ssh_config', '/.ssh/config', '/etc/ssh/ssh_config.d/file.conf', 'any/etc/ssh/ssh_config.d/file.conf', 'any/.ssh/config', 'any/.ssh/file.conf'], 783 \ 'sshdconfig': ['sshd_config', '/etc/ssh/sshd_config.d/file.conf', 'any/etc/ssh/sshd_config.d/file.conf'], 784 \ 'st': ['file.st'], 785 \ 'starlark': ['file.ipd', 'file.sky', 'file.star', 'file.starlark'], 786 \ 'stata': ['file.ado', 'file.do', 'file.imata', 'file.mata'], 787 \ 'stp': ['file.stp'], 788 \ 'stylus': ['a.styl', 'file.stylus'], 789 \ 'sudoers': ['any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers', 'any/etc/sudoers.d/file'], 790 \ 'supercollider': ['file.quark'], 791 \ 'surface': ['file.sface'], 792 \ 'svelte': ['file.svelte'], 793 \ 'svg': ['file.svg'], 794 \ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'], 795 \ 'sway': ['file.sw'], 796 \ 'swayconfig': ['/home/user/.sway/config', '/home/user/.config/sway/config', '/etc/sway/config', '/etc/xdg/sway/config', 797 \ '/home/user/sway/config.d/50-user.conf' ], 798 \ 'swift': ['file.swift', 'file.swiftinterface'], 799 \ 'swiftgyb': ['file.swift.gyb'], 800 \ 'swig': ['file.swg', 'file.swig'], 801 \ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'], 802 \ 'sysml': ['file.sysml'], 803 \ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.dnssd', 804 \ 'any/systemd/file.link', 'any/systemd/file.mount', 805 \ 'any/systemd/file.netdev', 'any/systemd/file.network', 806 \ 'any/systemd/file.nspawn', 'any/systemd/file.path', 807 \ 'any/systemd/file.service', 'any/systemd/file.slice', 808 \ 'any/systemd/file.socket', 'any/systemd/file.swap', 809 \ 'any/systemd/file.target', 'any/systemd/file.timer', 810 \ '/etc/systemd/some.conf.d/file.conf', 811 \ '/etc/systemd/system/some.d/file.conf', 812 \ '/etc/systemd/system/some.d/.#file', 813 \ '/etc/systemd/system/.#otherfile', 814 \ '/home/user/.config/systemd/user/some.d/mine.conf', 815 \ '/home/user/.config/systemd/user/some.d/.#file', 816 \ '/home/user/.config/systemd/user/.#otherfile', 817 \ '/.config/systemd/user/.#', '/.config/systemd/user/.#-file', 818 \ '/.config/systemd/user/file.d/.#', 819 \ '/.config/systemd/user/file.d/.#-file', 820 \ '/.config/systemd/user/file.d/file.conf', 821 \ '/etc/systemd/file.conf.d/file.conf', '/etc/systemd/system/.#', 822 \ '/etc/systemd/system/.#-file', '/etc/systemd/system/file.d/.#', 823 \ '/etc/systemd/system/file.d/.#-file', 824 \ '/etc/systemd/system/file.d/file.conf', 825 \ '/systemd/file.automount', '/systemd/file.dnssd', 826 \ '/systemd/file.link', '/systemd/file.mount', 827 \ '/systemd/file.netdev', '/systemd/file.network', 828 \ '/systemd/file.nspawn', '/systemd/file.path', 829 \ '/systemd/file.service', '/systemd/file.slice', 830 \ '/systemd/file.socket', '/systemd/file.swap', 831 \ '/systemd/file.target', '/systemd/file.timer', 832 \ 'any/.config/systemd/user/.#', 833 \ 'any/.config/systemd/user/.#-file', 834 \ 'any/.config/systemd/user/file.d/.#', 835 \ 'any/.config/systemd/user/file.d/.#-file', 836 \ 'any/.config/systemd/user/file.d/file.conf', 837 \ 'any/etc/systemd/file.conf.d/file.conf', 838 \ 'any/etc/systemd/system/.#', 'any/etc/systemd/system/.#-file', 839 \ 'any/etc/systemd/system/file.d/.#', 840 \ 'any/etc/systemd/system/file.d/.#-file', 841 \ 'any/etc/systemd/system/file.d/file.conf', 842 \ 'any/containers/systemd/file.artifact', 843 \ 'any/containers/systemd/file.build', 844 \ 'any/containers/systemd/file.container', 845 \ 'any/containers/systemd/file.image', 846 \ 'any/containers/systemd/file.kube', 847 \ 'any/containers/systemd/file.network', 848 \ 'any/containers/systemd/file.pod', 849 \ 'any/containers/systemd/file.volume', 850 \ 'any/containers/systemd/users/any/file.artifact', 851 \ 'any/containers/systemd/users/any/file.build', 852 \ 'any/containers/systemd/users/any/file.container', 853 \ 'any/containers/systemd/users/any/file.image', 854 \ 'any/containers/systemd/users/any/file.kube', 855 \ 'any/containers/systemd/users/any/file.network', 856 \ 'any/containers/systemd/users/any/file.pod', 857 \ 'any/containers/systemd/users/any/file.volume', 858 \ 'any/containers/systemd/users/file.artifact', 859 \ 'any/containers/systemd/users/file.build', 860 \ 'any/containers/systemd/users/file.container', 861 \ 'any/containers/systemd/users/file.image', 862 \ 'any/containers/systemd/users/file.kube', 863 \ 'any/containers/systemd/users/file.network', 864 \ 'any/containers/systemd/users/file.pod', 865 \ 'any/containers/systemd/users/file.volume', 866 \ 'any/containers/systemd/some.d/file.conf', 867 \ 'etc/containers/systemd/users/1111/some.d/file.conf', 868 \ 'etc/containers/systemd/users/some.d/file.conf'], 869 \ 'systemverilog': ['file.sv', 'file.svh'], 870 \ 'tablegen': ['file.td'], 871 \ 'tags': ['tags'], 872 \ 'tak': ['file.tak'], 873 \ 'tal': ['file.tal'], 874 \ 'taskdata': ['pending.data', 'completed.data', 'undo.data'], 875 \ 'taskedit': ['file.task'], 876 \ 'tcl': ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc', '.tclsh-history', 877 \ '.xsctcmdhistory', '.xsdbcmdhistory', 'vivado.jou', 'vivado.log'], 878 \ 'teal': ['file.tl'], 879 \ 'templ': ['file.templ'], 880 \ 'template': ['file.tmpl'], 881 \ 'tera': ['file.tera', 'file.toml.tera', 'file.html.tera', 'file.css.tera'], 882 \ 'teraterm': ['file.ttl'], 883 \ 'terminfo': ['file.ti'], 884 \ 'terraform-vars': ['file.tfvars'], 885 \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer', 'file.pdf_tex'], 886 \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], 887 \ 'texmf': ['texmf.cnf'], 888 \ 'text': ['file.text', 'file.txt', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'], 889 \ 'tf': ['file.tf', '.tfrc', 'tfrc'], 890 \ 'thrift': ['file.thrift'], 891 \ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'], 892 \ 'tiger': ['file.tig'], 893 \ 'tilde': ['file.t.html'], 894 \ 'tiltfile': ['Tiltfile', 'tiltfile', 'file.Tiltfile', 'file.tiltfile', 'Tiltfile.debian'], 895 \ 'tla': ['file.tla'], 896 \ 'tli': ['file.tli'], 897 \ 'tmux': ['tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf', 'tmux.conf.local'], 898 \ 'toml': ['file.toml', 'uv.lock', 'Gopkg.lock', 'Pipfile', '/home/user/.cargo/config', '.black', 899 \ 'any/containers/containers.conf', 'any/containers/containers.conf.d/file.conf', 900 \ 'any/containers/containers.conf.modules/file.conf', 'any/containers/containers.conf.modules/any/file.conf', 901 \ 'any/containers/registries.conf', 'any/containers/registries.conf.d/file.conf', 902 \ 'any/containers/storage.conf'], 903 \ 'tpp': ['file.tpp'], 904 \ 'trace32': ['file.cmm', 'file.cmmt', 'file.t32'], 905 \ 'treetop': ['file.treetop'], 906 \ 'trig': ['file.trig'], 907 \ 'trustees': ['trustees.conf'], 908 \ 'tsalt': ['file.slt'], 909 \ 'tsscl': ['file.tsscl'], 910 \ 'tssgm': ['file.tssgm'], 911 \ 'tssop': ['file.tssop'], 912 \ 'tsv': ['file.tsv'], 913 \ 'twig': ['file.twig'], 914 \ 'typescript': ['file.mts', 'file.cts', '.ts_node_repl_history'], 915 \ 'typescript.glimmer': ['file.gts'], 916 \ 'typescriptreact': ['file.tsx'], 917 \ 'typespec': ['file.tsp'], 918 \ 'uc': ['file.uc'], 919 \ 'udevconf': ['/etc/udev/udev.conf', 'any/etc/udev/udev.conf'], 920 \ 'udevperm': ['/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'], 921 \ 'udevrules': ['/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'], 922 \ 'uil': ['file.uit', 'file.uil'], 923 \ 'ungrammar': ['file.ungram'], 924 \ 'unison': ['file.u', 'file.uu'], 925 \ 'updatedb': ['/etc/updatedb.conf', 'any/etc/updatedb.conf'], 926 \ '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'], 927 \ 'upstreamdat': ['upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'], 928 \ 'upstreaminstalllog': ['upstreaminstall.log', 'UPSTREAMINSTALL.LOG', 'upstreaminstall.file.log', 'UPSTREAMINSTALL.FILE.LOG', 'file.upstreaminstall.log', 'FILE.UPSTREAMINSTALL.LOG'], 929 \ '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'], 930 \ 'urlshortcut': ['file.url'], 931 \ 'usd': ['file.usda', 'file.usd'], 932 \ 'usserverlog': ['usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'], 933 \ 'usw2kagtlog': ['usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'], 934 \ 'v': ['file.vsh', 'file.vv'], 935 \ 'vala': ['file.vala'], 936 \ 'vb': ['file.sba', 'file.vb', 'file.vbs', 'file.dsm', 'file.ctl', 'file.dob', 'file.dsr'], 937 \ 'vdf': ['file.vdf'], 938 \ 'vdmpp': ['file.vpp', 'file.vdmpp'], 939 \ 'vdmrt': ['file.vdmrt'], 940 \ 'vdmsl': ['file.vdm', 'file.vdmsl'], 941 \ 'vento': ['file.vto'], 942 \ 'vera': ['file.vr', 'file.vri', 'file.vrh'], 943 \ 'verilogams': ['file.va', 'file.vams'], 944 \ 'vgrindefs': ['vgrindefs'], 945 \ 'vhdl': ['file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst', 'file.vhdl_123', 'file.vho', 'some.vhdl_1', 'some.vhdl_1-file'], 946 \ 'vhs': ['file.tape'], 947 \ 'vim': ['file.vim', '.exrc', '_exrc', 'some-vimrc', 'some-vimrc-file', 'vimrc', 'vimrc-file', '.netrwhist'], 948 \ 'viminfo': ['.viminfo', '_viminfo'], 949 \ 'vmasm': ['file.mar'], 950 \ 'voscm': ['file.cm'], 951 \ 'vrml': ['file.wrl'], 952 \ 'vroom': ['file.vroom'], 953 \ 'vue': ['file.vue'], 954 \ 'wat': ['file.wat', 'file.wast'], 955 \ 'wdl': ['file.wdl'], 956 \ 'webmacro': ['file.wm'], 957 \ 'wget': ['.wgetrc', 'wgetrc'], 958 \ 'wget2': ['.wget2rc', 'wget2rc'], 959 \ 'wgsl': ['file.wgsl'], 960 \ 'winbatch': ['file.wbt'], 961 \ 'wit': ['file.wit'], 962 \ 'wml': ['file.wml'], 963 \ 'wsh': ['file.wsf', 'file.wsc'], 964 \ 'wsml': ['file.wsml'], 965 \ 'wvdial': ['wvdial.conf', '.wvdialrc'], 966 \ 'xcompose': ['.XCompose', 'Compose'], 967 \ 'xdefaults': ['.Xdefaults', '.Xpdefaults', '.Xresources', 'xdm-config', 'file.ad', '/Xresources/file', '/app-defaults/file', 'Xresources', 'Xresources-file', 'any/Xresources/file', 'any/app-defaults/file'], 968 \ 'xf86conf': ['xorg.conf', 'xorg.conf-4'], 969 \ 'xhtml': ['file.xhtml', 'file.xht'], 970 \ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'], 971 \ 'xkb': ['any/xkb/compat/pc', 'any/xkb/geometry/pc', 'any/xkb/keycodes/evdev', 'any/xkb/symbols/pc', 'any/xkb/types/pc', 972 \ 'any/.xkb/compat/pc', 'any/.xkb/geometry/pc', 'any/.xkb/keycodes/evdev', 'any/.xkb/symbols/pc', 'any/.xkb/types/pc'], 973 \ 'xmath': ['file.msc', 'file.msf'], 974 \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.user', 'file.ui', 975 \ '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', 976 \ 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd', 'fonts.conf', 'file.xcu', 'file.xlb', 'file.xlc', 'file.xba', 'file.xpr', 977 \ 'file.xpfm', 'file.spfm', 'file.bxml', 'file.mmi', 'file.slnx', 'Directory.Packages.props', 'Directory.Build.targets', 'Directory.Build.props'], 978 \ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'], 979 \ 'xpm': ['file.xpm'], 980 \ 'xpm2': ['file.xpm2'], 981 \ 'xquery': ['file.xq', 'file.xql', 'file.xqm', 'file.xquery', 'file.xqy'], 982 \ 'xs': ['file.xs'], 983 \ 'xsd': ['file.xsd'], 984 \ 'xslt': ['file.xsl', 'file.xslt'], 985 \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'], 986 \ 'yaml': ['file.yaml', 'file.yml', 'file.eyaml', 'file.kyaml', 'file.kyml', 'any/.bundle/config', '.clangd', '.clang-format', '.clang-tidy', 'file.mplstyle', 'matplotlibrc', 'yarn.lock', 987 \ '/home/user/.kube/config', '/home/user/.kube/kuberc', '.condarc', 'condarc', '.mambarc', 'mambarc', 'pixi.lock'], 988 \ 'yang': ['file.yang'], 989 \ 'yara': ['file.yara', 'file.yar'], 990 \ 'yuck': ['file.yuck'], 991 \ 'z8a': ['file.z8a'], 992 \ 'zathurarc': ['zathurarc'], 993 \ 'zig': ['file.zig', 'build.zig.zon'], 994 \ 'ziggy': ['file.ziggy'], 995 \ 'ziggy_schema': ['file.ziggy-schema'], 996 \ 'zimbu': ['file.zu'], 997 \ 'zimbutempl': ['file.zut'], 998 \ 'zserio': ['file.zs'], 999 \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', 'file.zsh-theme', 'file.zunit', 1000 \ '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zsh_history', 1001 \ '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 1002 \ 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'], 1003 \ } 1004 endfunc 1005 1006 func s:GetFilenameCaseChecks() abort 1007 return { 1008 \ 'modula2': ['file.DEF'], 1009 \ 'bzl': ['file.BUILD', 'BUILD', 'BUCK'], 1010 \ } 1011 endfunc 1012 1013 func CheckItems(checks) 1014 set noswapfile 1015 for [ft, names] in items(a:checks) 1016 for i in range(0, len(names) - 1) 1017 if isdirectory(fnameescape(names[i])) 1018 continue 1019 endif 1020 new 1021 try 1022 exe 'edit ' .. fnameescape(names[i]) 1023 catch 1024 call assert_report('cannot edit "' .. names[i] .. '": ' .. v:exception) 1025 endtry 1026 if &filetype == '' && &readonly 1027 " File exists but not able to edit it (permission denied) 1028 else 1029 let expected = ft == 'none' ? '' : ft 1030 call assert_equal(expected, &filetype, 'with file name: ' .. names[i]) 1031 endif 1032 bwipe! 1033 endfor 1034 endfor 1035 1036 set swapfile& 1037 endfunc 1038 1039 func Test_filetype_detection() 1040 call s:SetupConfigHome() 1041 if !empty(s:saveConfigHome) 1042 defer setenv("XDG_CONFIG_HOME", s:saveConfigHome) 1043 endif 1044 call mkdir(s:GetConfigHome(), 'R') 1045 1046 filetype on 1047 call CheckItems(s:GetFilenameChecks()) 1048 if has('fname_case') 1049 call CheckItems(s:GetFilenameCaseChecks()) 1050 endif 1051 filetype off 1052 endfunc 1053 1054 " Content lines that should not result in filetype detection 1055 func s:GetFalsePositiveChecks() abort 1056 return { 1057 \ '': [['test execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0']], 1058 \ } 1059 endfunc 1060 1061 " Filetypes detected from the file contents by scripts.vim 1062 func s:GetScriptChecks() abort 1063 return { 1064 \ 'virata': [['% Virata'], 1065 \ ['', '% Virata'], 1066 \ ['', '', '% Virata'], 1067 \ ['', '', '', '% Virata'], 1068 \ ['', '', '', '', '% Virata']], 1069 \ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'], 1070 \ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'], 1071 \ ['__libc_start_main and something']], 1072 \ 'clojure': [['#!/path/clojure']], 1073 \ 'scala': [['#!/path/scala']], 1074 \ 'sh': [['#!/path/sh'], 1075 \ ['#!/path/bash'], 1076 \ ['#!/path/bash2'], 1077 \ ['#!/path/dash'], 1078 \ ['#!/path/ksh'], 1079 \ ['#!/path/ksh93']], 1080 \ 'csh': [['#!/path/csh']], 1081 \ 'tcsh': [['#!/path/tcsh']], 1082 \ 'zsh': [['#!/path/zsh']], 1083 \ 'tcl': [['#!/path/tclsh'], 1084 \ ['#!/path/wish'], 1085 \ ['#!/path/expectk'], 1086 \ ['#!/path/itclsh'], 1087 \ ['#!/path/itkwish']], 1088 \ 'expect': [['#!/path/expect']], 1089 \ 'execline': [['#!/sbin/execlineb -S0'], ['#!/usr/bin/execlineb']], 1090 \ 'gnuplot': [['#!/path/gnuplot']], 1091 \ 'just': [['#!/path/just']], 1092 \ 'make': [['#!/path/make']], 1093 \ 'nix': [['#!/path/nix-shell']], 1094 \ 'pike': [['#!/path/pike'], 1095 \ ['#!/path/pike0'], 1096 \ ['#!/path/pike9']], 1097 \ 'lua': [['#!/path/lua']], 1098 \ 'raku': [['#!/path/raku']], 1099 \ 'perl': [['#!/path/perl']], 1100 \ 'php': [['#!/path/php']], 1101 \ 'python': [['#!/path/python'], 1102 \ ['#!/path/python2'], 1103 \ ['#!/path/python3']], 1104 \ 'groovy': [['#!/path/groovy']], 1105 \ 'ruby': [['#!/path/ruby']], 1106 \ 'javascript': [['#!/path/node'], 1107 \ ['#!/path/js'], 1108 \ ['#!/path/nodejs'], 1109 \ ['#!/path/rhino']], 1110 \ 'bc': [['#!/path/bc']], 1111 \ 'sed': [['#!/path/sed'], ['#n'], ['#n comment']], 1112 \ 'ocaml': [['#!/path/ocaml']], 1113 \ 'awk': [['#!/path/awk'], 1114 \ ['#!/path/gawk']], 1115 \ 'wml': [['#!/path/wml']], 1116 \ 'scheme': [['#!/path/scheme'], 1117 \ ['#!/path/guile']], 1118 \ 'cfengine': [['#!/path/cfengine']], 1119 \ 'erlang': [['#!/path/escript']], 1120 \ 'haskell': [['#!/path/haskell']], 1121 \ 'cpp': [['// Standard iostream objects -*- C++ -*-'], 1122 \ ['// -*- C++ -*-']], 1123 \ 'yaml': [['%YAML 1.2']], 1124 \ 'pascal': [['#!/path/instantfpc']], 1125 \ 'fennel': [['#!/path/fennel']], 1126 \ 'routeros': [['#!/path/rsc']], 1127 \ 'fish': [['#!/path/fish']], 1128 \ 'forth': [['#!/path/gforth']], 1129 \ 'icon': [['#!/path/icon']], 1130 \ 'crystal': [['#!/path/crystal']], 1131 \ 'rexx': [['#!/path/rexx'], 1132 \ ['#!/path/regina']], 1133 \ 'janet': [['#!/path/janet']], 1134 \ 'dart': [['#!/path/dart']], 1135 \ 'bpftrace': [['#!/path/bpftrace']], 1136 \ 'vim': [['#!/path/vim']], 1137 \ } 1138 endfunc 1139 1140 " Various forms of "env" optional arguments. 1141 func s:GetScriptEnvChecks() abort 1142 return { 1143 \ 'perl': [['#!/usr/bin/env VAR=val perl']], 1144 \ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']], 1145 \ 'awk': [['#!/usr/bin/env --split-string=VAR= awk -vFS="," -f']], 1146 \ 'ruby': [['#!/usr/bin/env --split-string=ruby --debug']], 1147 \ 'sed': [['#!/usr/bin/env -iS sed -f']], 1148 \ 'zsh': [['#!/usr/bin/env -iS VAR=val zsh -l']], 1149 \ 'execline': [['#!/usr/bin/env execlineb']], 1150 \ 'scheme': [['#!/usr/bin/env VAR=val --ignore-environment scheme']], 1151 \ 'sh': [['#!/usr/bin/env -S --ignore-environment VAR= sh -u']], 1152 \ 'python': [['#!/usr/bin/env -S -i VAR=val python -B -u']], 1153 \ 'csh': [['#!/usr/bin/env -S VAR= csh -f']], 1154 \ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']], 1155 \ 'nix': [['#!/usr/bin/env nix-shell']], 1156 \ } 1157 endfunc 1158 1159 func Run_script_detection(test_dict) 1160 filetype on 1161 for [ft, files] in items(a:test_dict) 1162 for file in files 1163 call writefile(file, 'Xtest', 'D') 1164 split Xtest 1165 call assert_equal(ft, &filetype, 'for text: ' . string(file)) 1166 bwipe! 1167 endfor 1168 endfor 1169 filetype off 1170 endfunc 1171 1172 func Test_script_detection() 1173 call Run_script_detection(s:GetFalsePositiveChecks()) 1174 call Run_script_detection(s:GetScriptChecks()) 1175 call Run_script_detection(s:GetScriptEnvChecks()) 1176 endfunc 1177 1178 func Test_setfiletype_completion() 1179 call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx') 1180 call assert_equal('"setfiletype java javacc javascript javascriptreact', @:) 1181 endfunc 1182 1183 " Test for ':filetype detect' command for a buffer without a file 1184 func Test_emptybuf_ftdetect() 1185 new 1186 call setline(1, '#!/bin/sh') 1187 call assert_equal('', &filetype) 1188 filetype detect 1189 call assert_equal('sh', &filetype) 1190 " close the swapfile 1191 bw! 1192 endfunc 1193 1194 " Test for ':filetype indent on' and ':filetype indent off' commands 1195 func Test_filetype_indent_off() 1196 new Xtest.vim 1197 filetype indent on 1198 call assert_equal(1, g:did_indent_on) 1199 call assert_equal(['filetype detection:ON plugin:OFF indent:ON'], 1200 \ execute('filetype')->split("\n")) 1201 filetype indent off 1202 call assert_equal(0, exists('g:did_indent_on')) 1203 call assert_equal(['filetype detection:ON plugin:OFF indent:OFF'], 1204 \ execute('filetype')->split("\n")) 1205 close 1206 endfunc 1207 1208 func Test_undo_ftplugin_on_buffer_reuse() 1209 filetype on 1210 1211 new 1212 let b:undo_ftplugin = ":let g:var='exists'" 1213 let g:bufnr = bufnr('%') 1214 " no changes done to the buffer, so the buffer will be re-used 1215 e $VIMRUNTIME/defaults.vim 1216 call assert_equal(g:bufnr, bufnr('%')) 1217 call assert_equal('exists', get(g:, 'var', 'fail')) 1218 unlet! g:bufnr g:var 1219 1220 " try to wipe the buffer 1221 enew 1222 bw defaults.vim 1223 let b:undo_ftplugin = ':bw' 1224 call assert_fails(':e $VIMRUNTIME/defaults.vim', 'E937:') 1225 1226 " try to split the window 1227 enew 1228 bw defaults.vim 1229 let b:undo_ftplugin = ':sp $VIMRUNTIME/defaults.vim' 1230 call assert_fails(':e $VIMRUNTIME/defaults.vim', 'E242:') 1231 1232 bwipe! 1233 filetype off 1234 endfunc 1235 1236 """"""""""""""""""""""""""""""""""""""""""""""""" 1237 " Tests for specific extensions and filetypes. 1238 " Keep sorted. 1239 """"""""""""""""""""""""""""""""""""""""""""""""" 1240 1241 " Since dist#ft#FTm4() looks around for configure.ac 1242 " the test needs to isolate itself in a fresh temporary project tree, 1243 " so that no configure.ac from another test (or from the repo root) 1244 " accidentally influences detection. 1245 func Test_autoconf_file() 1246 filetype on 1247 " Make a fresh sandbox far away from any configure.ac 1248 let save_cwd = getcwd() 1249 call mkdir('Xproj_autoconf/a/b', 'p') 1250 execute 'lcd Xproj_autoconf/a/b' 1251 1252 try 1253 call writefile(['AC_CHECK_HEADERS([stdio.h])'], 'foo.m4', 'D') 1254 split foo.m4 1255 call assert_equal('config', &filetype) 1256 bwipe! 1257 1258 call writefile(['AS_IF([true], [:])'], 'bar.m4', 'D') 1259 split bar.m4 1260 call assert_equal('config', &filetype) 1261 bwipe! 1262 1263 call writefile(['AC_INIT([foo],[1.0])'], 'configure.ac') 1264 call mkdir('m4', 'p') 1265 call writefile([], 'm4/empty.m4', 'D') 1266 split m4/empty.m4 1267 call assert_equal('config', &filetype) 1268 bwipe! 1269 finally 1270 call delete('m4', 'rf') 1271 call delete('configure.ac') 1272 execute 'lcd' fnameescape(save_cwd) 1273 call delete('Xproj_autoconf', 'rf') 1274 filetype off 1275 endtry 1276 endfunc 1277 1278 func Test_bas_file() 1279 filetype on 1280 1281 call writefile(['looks like BASIC'], 'Xfile.bas', 'D') 1282 split Xfile.bas 1283 call assert_equal('basic', &filetype) 1284 bwipe! 1285 1286 " Test dist#ft#FTbas() 1287 1288 let g:filetype_bas = 'freebasic' 1289 split Xfile.bas 1290 call assert_equal('freebasic', &filetype) 1291 bwipe! 1292 unlet g:filetype_bas 1293 1294 " FreeBASIC 1295 1296 call writefile(["/' FreeBASIC multiline comment '/"], 'Xfile.bas') 1297 split Xfile.bas 1298 call assert_equal('freebasic', &filetype) 1299 bwipe! 1300 1301 call writefile(['#define TESTING'], 'Xfile.bas') 1302 split Xfile.bas 1303 call assert_equal('freebasic', &filetype) 1304 bwipe! 1305 1306 call writefile(['option byval'], 'Xfile.bas') 1307 split Xfile.bas 1308 call assert_equal('freebasic', &filetype) 1309 bwipe! 1310 1311 call writefile(['extern "C"'], 'Xfile.bas') 1312 split Xfile.bas 1313 call assert_equal('freebasic', &filetype) 1314 bwipe! 1315 1316 " QB64 1317 1318 call writefile(['$LET TESTING = 1'], 'Xfile.bas') 1319 split Xfile.bas 1320 call assert_equal('qb64', &filetype) 1321 bwipe! 1322 1323 call writefile(['OPTION _EXPLICIT'], 'Xfile.bas') 1324 split Xfile.bas 1325 call assert_equal('qb64', &filetype) 1326 bwipe! 1327 1328 " Visual Basic 1329 1330 call writefile(['Attribute VB_NAME = "Testing"', 'Enum Foo', 'End Enum'], 'Xfile.bas') 1331 split Xfile.bas 1332 call assert_equal('vb', &filetype) 1333 bwipe! 1334 1335 filetype off 1336 endfunc 1337 1338 " Test dist#ft#FTcfg() 1339 func Test_cfg_file() 1340 filetype on 1341 1342 " *.cfg defaults to cfg 1343 call writefile(['looks like cfg'], 'cfgfile.cfg', 'D') 1344 split cfgfile.cfg 1345 call assert_equal('cfg', &filetype) 1346 1347 let g:filetype_cfg = 'other' 1348 edit 1349 call assert_equal('other', &filetype) 1350 bwipe! 1351 unlet g:filetype_cfg 1352 1353 " RAPID cfg 1354 for i in ['EIO', 'MMC', 'MOC', 'PROC', 'SIO', 'SYS'] 1355 for ext in ['cfg', 'Cfg', 'CFG'] 1356 call writefile([i .. ':CFG'], 'cfgfile.' .. ext) 1357 execute "split cfgfile." .. ext 1358 call assert_equal('rapid', &filetype) 1359 bwipe! 1360 call delete('cfgfile.' .. ext) 1361 endfor 1362 endfor 1363 1364 " clean up 1365 filetype off 1366 endfunc 1367 1368 func Test_cl_file() 1369 filetype on 1370 1371 call writefile(['/*', ' * Xfile.cl', ' */', 'int f() {}'], 'Xfile.cl') 1372 split Xfile.cl 1373 call assert_equal('opencl', &filetype) 1374 bwipe! 1375 1376 call writefile(['()'], 'Xfile.cl') 1377 split Xfile.cl 1378 call assert_equal('lisp', &filetype) 1379 bwipe! 1380 1381 filetype off 1382 endfunc 1383 1384 func Test_d_file() 1385 filetype on 1386 1387 call writefile(['looks like D'], 'Xfile.d', 'D') 1388 split Xfile.d 1389 call assert_equal('d', &filetype) 1390 bwipe! 1391 1392 call writefile(['#!/some/bin/dtrace'], 'Xfile.d') 1393 split Xfile.d 1394 call assert_equal('dtrace', &filetype) 1395 bwipe! 1396 1397 call writefile(['#pragma D option'], 'Xfile.d') 1398 split Xfile.d 1399 call assert_equal('dtrace', &filetype) 1400 bwipe! 1401 1402 call writefile([':some:thing:'], 'Xfile.d') 1403 split Xfile.d 1404 call assert_equal('dtrace', &filetype) 1405 bwipe! 1406 1407 call writefile(['module this', '#pragma D option'], 'Xfile.d') 1408 split Xfile.d 1409 call assert_equal('d', &filetype) 1410 bwipe! 1411 1412 call writefile(['import that', '#pragma D option'], 'Xfile.d') 1413 split Xfile.d 1414 call assert_equal('d', &filetype) 1415 bwipe! 1416 1417 " clean up 1418 filetype off 1419 endfunc 1420 1421 func Test_dat_file() 1422 filetype on 1423 1424 " KRL header start with "&WORD", but is not always present. 1425 call writefile(['&ACCESS'], 'datfile.dat') 1426 split datfile.dat 1427 call assert_equal('krl', &filetype) 1428 bwipe! 1429 call delete('datfile.dat') 1430 1431 " KRL defdat with leading spaces, for KRL file extension is not case 1432 " sensitive. 1433 call writefile([' DEFDAT datfile'], 'datfile.Dat') 1434 split datfile.Dat 1435 call assert_equal('krl', &filetype) 1436 bwipe! 1437 call delete('datfile.Dat') 1438 1439 " KRL defdat with embedded spaces, file starts with empty line(s). 1440 call writefile(['', 'defdat datfile public'], 'datfile.DAT') 1441 split datfile.DAT 1442 call assert_equal('krl', &filetype) 1443 bwipe! 1444 1445 " User may overrule file inspection 1446 let g:filetype_dat = 'dat' 1447 split datfile.DAT 1448 call assert_equal('dat', &filetype) 1449 bwipe! 1450 call delete('datfile.DAT') 1451 unlet g:filetype_dat 1452 1453 filetype off 1454 endfunc 1455 1456 func Test_dep3patch_file() 1457 filetype on 1458 1459 call assert_true(mkdir('debian/patches', 'pR')) 1460 1461 " series files are not patches 1462 call writefile(['Description: some awesome patch'], 'debian/patches/series') 1463 split debian/patches/series 1464 call assert_notequal('dep3patch', &filetype) 1465 bwipe! 1466 1467 " diff/patch files without the right headers should still show up as ft=diff 1468 call writefile([], 'debian/patches/foo.diff') 1469 split debian/patches/foo.diff 1470 call assert_equal('diff', &filetype) 1471 bwipe! 1472 1473 " Files with the right headers are detected as dep3patch, even if they don't 1474 " have a diff/patch extension 1475 call writefile(['Subject: dep3patches'], 'debian/patches/bar') 1476 split debian/patches/bar 1477 call assert_equal('dep3patch', &filetype) 1478 bwipe! 1479 1480 " Files in sub-directories are detected 1481 call assert_true(mkdir('debian/patches/s390x', 'p')) 1482 call writefile(['Subject: dep3patches'], 'debian/patches/s390x/bar') 1483 split debian/patches/s390x/bar 1484 call assert_equal('dep3patch', &filetype) 1485 bwipe! 1486 1487 " The detection stops when seeing the "header end" marker 1488 call writefile(['---', 'Origin: the cloud'], 'debian/patches/baz') 1489 split debian/patches/baz 1490 call assert_notequal('dep3patch', &filetype) 1491 bwipe! 1492 endfunc 1493 1494 func Test_dsl_file() 1495 filetype on 1496 1497 call writefile([' <!doctype dsssl-spec ['], 'dslfile.dsl', 'D') 1498 split dslfile.dsl 1499 call assert_equal('dsl', &filetype) 1500 bwipe! 1501 1502 call writefile(['workspace {'], 'dslfile.dsl') 1503 split dslfile.dsl 1504 call assert_equal('structurizr', &filetype) 1505 bwipe! 1506 1507 filetype off 1508 endfunc 1509 1510 func Test_ex_file() 1511 filetype on 1512 1513 call writefile(['arbitrary content'], 'Xfile.ex', 'D') 1514 split Xfile.ex 1515 call assert_equal('elixir', &filetype) 1516 bwipe! 1517 let g:filetype_euphoria = 'euphoria4' 1518 split Xfile.ex 1519 call assert_equal('euphoria4', &filetype) 1520 bwipe! 1521 unlet g:filetype_euphoria 1522 1523 call writefile(['-- filetype euphoria comment'], 'Xfile.ex') 1524 split Xfile.ex 1525 call assert_equal('euphoria3', &filetype) 1526 bwipe! 1527 1528 call writefile(['--filetype euphoria comment'], 'Xfile.ex') 1529 split Xfile.ex 1530 call assert_equal('euphoria3', &filetype) 1531 bwipe! 1532 1533 call writefile(['ifdef '], 'Xfile.ex') 1534 split Xfile.ex 1535 call assert_equal('euphoria3', &filetype) 1536 bwipe! 1537 1538 call writefile(['include '], 'Xfile.ex') 1539 split Xfile.ex 1540 call assert_equal('euphoria3', &filetype) 1541 bwipe! 1542 1543 filetype off 1544 endfunc 1545 1546 func Test_f_file() 1547 filetype on 1548 1549 call writefile(['looks like Fortran'], 'Xfile.f', 'D') 1550 split Xfile.f 1551 call assert_equal('fortran', &filetype) 1552 bwipe! 1553 1554 let g:filetype_f = 'forth' 1555 split Xfile.f 1556 call assert_equal('forth', &filetype) 1557 bwipe! 1558 unlet g:filetype_f 1559 1560 " Test dist#ft#FTf() 1561 1562 " Forth 1563 1564 call writefile(['( Forth inline comment )'], 'Xfile.f') 1565 split Xfile.f 1566 call assert_equal('forth', &filetype) 1567 bwipe! 1568 1569 call writefile(['\ Forth line comment'], 'Xfile.f') 1570 split Xfile.f 1571 call assert_equal('forth', &filetype) 1572 bwipe! 1573 1574 call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.f') 1575 split Xfile.f 1576 call assert_equal('forth', &filetype) 1577 bwipe! 1578 1579 " SwiftForth 1580 1581 call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.f') 1582 split Xfile.f 1583 call assert_equal('forth', &filetype) 1584 bwipe! 1585 1586 call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.f') 1587 split Xfile.f 1588 call assert_equal('forth', &filetype) 1589 bwipe! 1590 1591 filetype off 1592 endfunc 1593 1594 func Test_foam_file() 1595 filetype on 1596 call assert_true(mkdir('0', 'pR')) 1597 call assert_true(mkdir('0.orig', 'pR')) 1598 1599 call writefile(['FoamFile {', ' object something;'], 'Xfile1Dict', 'D') 1600 split Xfile1Dict 1601 call assert_equal('foam', &filetype) 1602 bwipe! 1603 1604 call writefile(['FoamFile {', ' object something;'], 'Xfile1Dict.something', 'D') 1605 split Xfile1Dict.something 1606 call assert_equal('foam', &filetype) 1607 bwipe! 1608 1609 call writefile(['FoamFile {', ' object something;'], 'XfileProperties', 'D') 1610 split XfileProperties 1611 call assert_equal('foam', &filetype) 1612 bwipe! 1613 1614 call writefile(['FoamFile {', ' object something;'], 'XfileProperties.something', 'D') 1615 split XfileProperties.something 1616 call assert_equal('foam', &filetype) 1617 bwipe! 1618 1619 call writefile(['FoamFile {', ' object something;'], 'XfileProperties') 1620 split XfileProperties 1621 call assert_equal('foam', &filetype) 1622 bwipe! 1623 1624 call writefile(['FoamFile {', ' object something;'], 'XfileProperties.something') 1625 split XfileProperties.something 1626 call assert_equal('foam', &filetype) 1627 bwipe! 1628 1629 call writefile(['FoamFile {', ' object something;'], '0/Xfile') 1630 split 0/Xfile 1631 call assert_equal('foam', &filetype) 1632 bwipe! 1633 1634 call writefile(['FoamFile {', ' object something;'], '0.orig/Xfile') 1635 split 0.orig/Xfile 1636 call assert_equal('foam', &filetype) 1637 bwipe! 1638 1639 filetype off 1640 endfunc 1641 1642 func Test_frm_file() 1643 filetype on 1644 1645 call writefile(['looks like FORM'], 'Xfile.frm', 'D') 1646 split Xfile.frm 1647 call assert_equal('form', &filetype) 1648 bwipe! 1649 1650 " Test dist#ft#FTfrm() 1651 1652 let g:filetype_frm = 'form' 1653 split Xfile.frm 1654 call assert_equal('form', &filetype) 1655 bwipe! 1656 unlet g:filetype_frm 1657 1658 " Visual Basic 1659 1660 call writefile(['VERSION 5.00', 'Begin VB.Form Form1'], 'Xfile.frm') 1661 split Xfile.frm 1662 call assert_equal('vb', &filetype) 1663 bwipe! 1664 1665 filetype off 1666 endfunc 1667 1668 func Test_fs_file() 1669 filetype on 1670 1671 call writefile(['looks like F#'], 'Xfile.fs', 'D') 1672 split Xfile.fs 1673 call assert_equal('fsharp', &filetype) 1674 bwipe! 1675 1676 let g:filetype_fs = 'forth' 1677 split Xfile.fs 1678 call assert_equal('forth', &filetype) 1679 bwipe! 1680 unlet g:filetype_fs 1681 1682 " Test dist#ft#FTfs() 1683 1684 " Forth 1685 1686 call writefile(['( Forth inline comment )'], 'Xfile.fs') 1687 split Xfile.fs 1688 call assert_equal('forth', &filetype) 1689 bwipe! 1690 1691 call writefile(['\ Forth line comment'], 'Xfile.fs') 1692 split Xfile.fs 1693 call assert_equal('forth', &filetype) 1694 bwipe! 1695 1696 call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.fs') 1697 split Xfile.fs 1698 call assert_equal('forth', &filetype) 1699 bwipe! 1700 1701 " SwiftForth 1702 1703 call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.fs') 1704 split Xfile.fs 1705 call assert_equal('forth', &filetype) 1706 bwipe! 1707 1708 call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.fs') 1709 split Xfile.fs 1710 call assert_equal('forth', &filetype) 1711 bwipe! 1712 1713 filetype off 1714 endfunc 1715 1716 func Test_git_file() 1717 filetype on 1718 1719 call assert_true(mkdir('Xrepo.git', 'pR')) 1720 1721 call writefile([], 'Xrepo.git/HEAD') 1722 split Xrepo.git/HEAD 1723 call assert_equal('', &filetype) 1724 bwipe! 1725 1726 call writefile(['0000000000000000000000000000000000000000'], 'Xrepo.git/HEAD') 1727 split Xrepo.git/HEAD 1728 call assert_equal('git', &filetype) 1729 bwipe! 1730 1731 call writefile(['0000000000000000000000000000000000000000000000000000000000000000'], 'Xrepo.git/HEAD') 1732 split Xrepo.git/HEAD 1733 call assert_equal('git', &filetype) 1734 bwipe! 1735 1736 call writefile(['ref: refs/heads/master'], 'Xrepo.git/HEAD') 1737 split Xrepo.git/HEAD 1738 call assert_equal('git', &filetype) 1739 bwipe! 1740 1741 filetype off 1742 endfunc 1743 1744 func Test_grc_file() 1745 filetype on 1746 1747 call writefile(['<?xml version="1.0"?>', '<block>', '</block>'], 'Xfile.grc') 1748 split Xfile.grc 1749 call assert_equal('xml', &filetype) 1750 bwipe! 1751 1752 call writefile(['metadata:', ' file_format: 1'], 'Xfile.grc') 1753 split Xfile.grc 1754 call assert_equal('yaml', &filetype) 1755 bwipe! 1756 1757 filetype off 1758 endfunc 1759 1760 func Test_haredoc_file() 1761 filetype on 1762 call assert_true(mkdir('foo/bar', 'pR')) 1763 1764 call writefile([], 'README', 'D') 1765 split README 1766 call assert_notequal('haredoc', &filetype) 1767 bwipe! 1768 1769 let g:filetype_haredoc = 1 1770 split README 1771 call assert_notequal('haredoc', &filetype) 1772 bwipe! 1773 1774 call writefile([], 'foo/quux.ha') 1775 split README 1776 call assert_equal('haredoc', &filetype) 1777 bwipe! 1778 call delete('foo/quux.ha') 1779 1780 call writefile([], 'foo/bar/baz.ha', 'D') 1781 split README 1782 call assert_notequal('haredoc', &filetype) 1783 bwipe! 1784 1785 let g:haredoc_search_depth = 2 1786 split README 1787 call assert_equal('haredoc', &filetype) 1788 bwipe! 1789 unlet g:filetype_haredoc 1790 unlet g:haredoc_search_depth 1791 1792 filetype off 1793 endfunc 1794 1795 func Test_help_file() 1796 func! s:Check_help_with_iskeyword(fname) 1797 exe 'split' a:fname 1798 call assert_equal('help', &filetype) 1799 bwipe! 1800 set iskeyword+=: 1801 exe 'split' a:fname 1802 call assert_equal('help', &filetype) 1803 bwipe! 1804 set iskeyword& 1805 endfunc 1806 1807 set nomodeline 1808 filetype on 1809 call assert_true(mkdir('doc', 'pR')) 1810 1811 call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D') 1812 call s:Check_help_with_iskeyword('doc/help.txt') 1813 1814 call writefile(['some text', 'Copyright: |manual-copyright| vim:ft=help:'], 1815 \ 'doc/help1.txt', 'D') 1816 call s:Check_help_with_iskeyword('doc/help1.txt') 1817 1818 call writefile(['some text', 'vim:noet:ft=help:'], 'doc/help2.txt', 'D') 1819 call s:Check_help_with_iskeyword('doc/help2.txt') 1820 1821 call writefile(['some text', 'vim: noet ft=help'], 'doc/help3.txt', 'D') 1822 call s:Check_help_with_iskeyword('doc/help3.txt') 1823 1824 call writefile(['some text', 'vim: ft=help noet'], 'doc/help4.txt', 'D') 1825 call s:Check_help_with_iskeyword('doc/help4.txt') 1826 1827 call writefile(['some text'], 'doc/nothelp.txt', 'D') 1828 split doc/nothelp.txt 1829 call assert_notequal('help', &filetype) 1830 bwipe! 1831 1832 call writefile(['some text', '`vim:ft=help`'], 'doc/nothelp1.txt', 'D') 1833 split doc/nothelp1.txt 1834 call assert_notequal('help', &filetype) 1835 bwipe! 1836 1837 filetype off 1838 set modeline& 1839 endfunc 1840 1841 func Test_hook_file() 1842 filetype on 1843 1844 call writefile(['[Trigger]', 'this is pacman config'], 'Xfile.hook', 'D') 1845 split Xfile.hook 1846 call assert_equal('confini', &filetype) 1847 bwipe! 1848 1849 call writefile(['not pacman'], 'Xfile.hook') 1850 split Xfile.hook 1851 call assert_notequal('confini', &filetype) 1852 bwipe! 1853 1854 filetype off 1855 endfunc 1856 1857 func Test_html_file() 1858 filetype on 1859 1860 " HTML Angular 1861 let content = ['@for (item of items; track item.name) {', ' <li> {{ item.name }}</li>', '} @empty {', ' <li> There are no items.</li>', '}'] 1862 call writefile(content, 'Xfile.html', 'D') 1863 split Xfile.html 1864 call assert_equal('htmlangular', &filetype) 1865 bwipe! 1866 1867 " Django Template 1868 let content = ['{% if foobar %}', 1869 \ ' <ul>', 1870 \ ' {% for question in list %}', 1871 \ ' <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li>', 1872 \ ' {% endfor %}', 1873 \ ' </ul>', 1874 \ '{% else %}', 1875 \ ' <p>No polls are available.</p>', 1876 \ '{% endif %}'] 1877 call writefile(content, 'Xfile.html', 'D') 1878 split Xfile.html 1879 call assert_equal('htmldjango', &filetype) 1880 bwipe! 1881 1882 " Super html layout 1883 let content = ['<extend template="base.shtml">', 1884 \ '<title id="title" var="$page.title"></title>', 1885 \ '<head id="head"></head>', 1886 \ '<div id="content">', 1887 \ '</div>'] 1888 call writefile(content, 'Xfile.shtml', 'D') 1889 split Xfile.shtml 1890 call assert_equal('superhtml', &filetype) 1891 bwipe! 1892 1893 " Super html template 1894 let content = ['<!DOCTYPE html>', 1895 \ '<html>', 1896 \ ' <head id="head">', 1897 \ ' <title id="title">', 1898 \ ' <super>', 1899 \ ' suffix', 1900 \ ' </title>', 1901 \ ' <super>', 1902 \ ' </head>', 1903 \ ' <body>', 1904 \ ' <div id="content">', 1905 \ ' <super>', 1906 \ ' </div>', 1907 \ ' </body>', 1908 \ '</html>'] 1909 call writefile(content, 'Xfile.shtml', 'D') 1910 split Xfile.shtml 1911 call assert_equal('superhtml', &filetype) 1912 bwipe! 1913 1914 " regular HTML 1915 let content = ['<!DOCTYPE html>', '<html>', ' <head>Foobar</head>', ' <body>Content', ' </body>', '</html>'] 1916 call writefile(content, 'Xfile.html', 'D') 1917 split Xfile.html 1918 call assert_equal('html', &filetype) 1919 bwipe! 1920 1921 filetype off 1922 endfunc 1923 1924 func Test_m_file() 1925 filetype on 1926 1927 call writefile(['looks like Matlab'], 'Xfile.m', 'D') 1928 split Xfile.m 1929 call assert_equal('matlab', &filetype) 1930 bwipe! 1931 1932 let g:filetype_m = 'octave' 1933 split Xfile.m 1934 call assert_equal('octave', &filetype) 1935 bwipe! 1936 unlet g:filetype_m 1937 1938 " Test dist#ft#FTm() 1939 1940 " Objective-C 1941 1942 call writefile(['// Objective-C line comment'], 'Xfile.m') 1943 split Xfile.m 1944 call assert_equal('objc', &filetype) 1945 bwipe! 1946 1947 call writefile(['/* Objective-C block comment */'], 'Xfile.m') 1948 split Xfile.m 1949 call assert_equal('objc', &filetype) 1950 bwipe! 1951 1952 call writefile(['#import "test.m"'], 'Xfile.m') 1953 split Xfile.m 1954 call assert_equal('objc', &filetype) 1955 bwipe! 1956 1957 call writefile(['#include <header.h>'], 'Xfile.m') 1958 split Xfile.m 1959 call assert_equal('objc', &filetype) 1960 bwipe! 1961 1962 call writefile(['#define FORTY_TWO'], 'Xfile.m') 1963 split Xfile.m 1964 call assert_equal('objc', &filetype) 1965 bwipe! 1966 1967 " Octave 1968 1969 call writefile(['# Octave line comment'], 'Xfile.m') 1970 split Xfile.m 1971 call assert_equal('octave', &filetype) 1972 bwipe! 1973 1974 call writefile(['%!test "Octave test"'], 'Xfile.m') 1975 split Xfile.m 1976 call assert_equal('octave', &filetype) 1977 bwipe! 1978 1979 call writefile(['unwind_protect'], 'Xfile.m') 1980 split Xfile.m 1981 call assert_equal('octave', &filetype) 1982 bwipe! 1983 1984 call writefile(['try; 42; end_try_catch'], 'Xfile.m') 1985 split Xfile.m 1986 call assert_equal('octave', &filetype) 1987 bwipe! 1988 1989 " Mathematica 1990 1991 call writefile(['(* Mathematica comment'], 'Xfile.m') 1992 split Xfile.m 1993 call assert_equal('mma', &filetype) 1994 bwipe! 1995 1996 " MATLAB 1997 1998 call writefile(['% MATLAB line comment'], 'Xfile.m') 1999 split Xfile.m 2000 call assert_equal('matlab', &filetype) 2001 bwipe! 2002 2003 " Murphi 2004 2005 call writefile(['-- Murphi comment'], 'Xfile.m') 2006 split Xfile.m 2007 call assert_equal('murphi', &filetype) 2008 bwipe! 2009 2010 call writefile(['/* Murphi block comment */', 'Type'], 'Xfile.m') 2011 split Xfile.m 2012 call assert_equal('murphi', &filetype) 2013 bwipe! 2014 2015 call writefile(['Type'], 'Xfile.m') 2016 split Xfile.m 2017 call assert_equal('murphi', &filetype) 2018 bwipe! 2019 2020 filetype off 2021 endfunc 2022 2023 " Since dist#ft#FTm4() looks around for configure.ac 2024 " the test needs to isolate itself in a fresh temporary project tree, 2025 " so that no configure.ac from another test (or from the repo root) 2026 " accidentally influences detection. 2027 func Test_m4_file() 2028 filetype on 2029 let save_cwd = getcwd() 2030 2031 " Make a fresh sandbox far away from any configure.ac 2032 call mkdir('Xsandbox/level1/level2', 'p') 2033 execute 'lcd Xsandbox/level1/level2' 2034 2035 try 2036 call writefile(["define(`FOO', `bar')", "FOO"], 'plain.m4', 'D') 2037 split plain.m4 2038 call assert_equal('m4', &filetype) 2039 bwipe! 2040 finally 2041 execute 'lcd' fnameescape(save_cwd) 2042 call delete('Xsandbox', 'rf') 2043 filetype off 2044 endtry 2045 endfunc 2046 2047 func Test_mod_file() 2048 filetype on 2049 2050 " *.mod defaults to Modsim III 2051 call writefile(['locks like Modsim III'], 'Xfile.mod', 'D') 2052 split Xfile.mod 2053 call assert_equal('modsim3', &filetype) 2054 bwipe! 2055 2056 " Users preference set by g:filetype_mod 2057 let g:filetype_mod = 'lprolog' 2058 split Xfile.mod 2059 call assert_equal('lprolog', &filetype) 2060 unlet g:filetype_mod 2061 bwipe! 2062 2063 " LambdaProlog module 2064 call writefile(['module lpromod.'], 'Xfile.mod') 2065 split Xfile.mod 2066 call assert_equal('lprolog', &filetype) 2067 bwipe! 2068 2069 " LambdaProlog with comment and empty lines prior module 2070 call writefile(['', '% with', '% comment', '', 'module lpromod.'], 'Xfile.mod') 2071 split Xfile.mod 2072 call assert_equal('lprolog', &filetype) 2073 bwipe! 2074 2075 " RAPID header start with a line containing only "%%%", 2076 " but is not always present. 2077 call writefile(['%%%'], 'Xfile.mod') 2078 split Xfile.mod 2079 call assert_equal('rapid', &filetype) 2080 bwipe! 2081 2082 " RAPID supports umlauts in module names, leading spaces, 2083 " the .mod extension is not case sensitive. 2084 call writefile([' module ÜmlautModule'], 'Xfile.Mod', 'D') 2085 split Xfile.Mod 2086 call assert_equal('rapid', &filetype) 2087 bwipe! 2088 2089 " RAPID is not case sensitive, embedded spaces, sysmodule, 2090 " file starts with empty line(s). 2091 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'Xfile.MOD', 'D') 2092 split Xfile.MOD 2093 call assert_equal('rapid', &filetype) 2094 bwipe! 2095 2096 " Modula-2 MODULE not start of line 2097 call writefile(['IMPLEMENTATION MODULE Module2Mod;'], 'Xfile.mod') 2098 split Xfile.mod 2099 call assert_equal('modula2', &filetype) 2100 call assert_equal('pim', b:modula2.dialect) 2101 bwipe! 2102 2103 " Modula-2 with comment and empty lines prior MODULE 2104 call writefile(['', '(* with', ' comment *)', '', 'MODULE Module2Mod;'], 'Xfile.mod') 2105 split Xfile.mod 2106 call assert_equal('modula2', &filetype) 2107 call assert_equal('pim', b:modula2.dialect) 2108 bwipe! 2109 2110 " Modula-2 program MODULE with priority (and uppercase extension) 2111 call writefile(['MODULE Module2Mod [42];'], 'Xfile.MOD') 2112 split Xfile.MOD 2113 call assert_equal('modula2', &filetype) 2114 call assert_equal('pim', b:modula2.dialect) 2115 bwipe! 2116 2117 " Modula-2 implementation MODULE with priority (and uppercase extension) 2118 call writefile(['IMPLEMENTATION MODULE Module2Mod [42];'], 'Xfile.MOD') 2119 split Xfile.MOD 2120 call assert_equal('modula2', &filetype) 2121 call assert_equal('pim', b:modula2.dialect) 2122 bwipe! 2123 2124 " go.mod 2125 call writefile(['module example.com/M'], 'go.mod', 'D') 2126 split go.mod 2127 call assert_equal('gomod', &filetype) 2128 bwipe! 2129 2130 call writefile(['module M'], 'go.mod') 2131 split go.mod 2132 call assert_equal('gomod', &filetype) 2133 bwipe! 2134 2135 filetype off 2136 endfunc 2137 2138 func Test_patch_file() 2139 filetype on 2140 2141 call writefile([], 'Xfile.patch', 'D') 2142 split Xfile.patch 2143 call assert_equal('diff', &filetype) 2144 bwipe! 2145 2146 call writefile(['From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001'], 'Xfile.patch') 2147 split Xfile.patch 2148 call assert_equal('gitsendemail', &filetype) 2149 bwipe! 2150 2151 call writefile(['From 0000000000000000000000000000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001'], 'Xfile.patch') 2152 split Xfile.patch 2153 call assert_equal('gitsendemail', &filetype) 2154 bwipe! 2155 2156 filetype off 2157 endfunc 2158 2159 func Test_perl_file() 2160 filetype on 2161 2162 " only tests one case, should do more 2163 let lines =<< trim END 2164 2165 use a 2166 END 2167 call writefile(lines, "Xfile.t", 'D') 2168 split Xfile.t 2169 call assert_equal('perl', &filetype) 2170 bwipe 2171 2172 filetype off 2173 endfunc 2174 2175 func Test_pp_file() 2176 filetype on 2177 2178 call writefile(['looks like puppet'], 'Xfile.pp', 'D') 2179 split Xfile.pp 2180 call assert_equal('puppet', &filetype) 2181 bwipe! 2182 2183 let g:filetype_pp = 'pascal' 2184 split Xfile.pp 2185 call assert_equal('pascal', &filetype) 2186 bwipe! 2187 unlet g:filetype_pp 2188 2189 " Test dist#ft#FTpp() 2190 call writefile(['{ pascal comment'], 'Xfile.pp') 2191 split Xfile.pp 2192 call assert_equal('pascal', &filetype) 2193 bwipe! 2194 2195 call writefile(['procedure pascal'], 'Xfile.pp') 2196 split Xfile.pp 2197 call assert_equal('pascal', &filetype) 2198 bwipe! 2199 2200 filetype off 2201 endfunc 2202 2203 " Test dist#ft#FTprg() 2204 func Test_prg_file() 2205 filetype on 2206 2207 " *.prg defaults to clipper 2208 call writefile(['looks like clipper'], 'prgfile.prg') 2209 split prgfile.prg 2210 call assert_equal('clipper', &filetype) 2211 bwipe! 2212 2213 " Users preference set by g:filetype_prg 2214 let g:filetype_prg = 'eviews' 2215 split prgfile.prg 2216 call assert_equal('eviews', &filetype) 2217 unlet g:filetype_prg 2218 bwipe! 2219 2220 " RAPID header start with a line containing only "%%%", 2221 " but is not always present. 2222 call writefile(['%%%'], 'prgfile.prg') 2223 split prgfile.prg 2224 call assert_equal('rapid', &filetype) 2225 bwipe! 2226 call delete('prgfile.prg') 2227 2228 " RAPID supports umlauts in module names, leading spaces, 2229 " the .prg extension is not case sensitive. 2230 call writefile([' module ÜmlautModule'], 'prgfile.Prg') 2231 split prgfile.Prg 2232 call assert_equal('rapid', &filetype) 2233 bwipe! 2234 call delete('prgfile.Prg') 2235 2236 " RAPID is not case sensitive, embedded spaces, sysmodule, 2237 " file starts with empty line(s). 2238 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'prgfile.PRG') 2239 split prgfile.PRG 2240 call assert_equal('rapid', &filetype) 2241 bwipe! 2242 call delete('prgfile.PRG') 2243 2244 filetype off 2245 endfunc 2246 2247 " Test dist#ft#FTsc() 2248 func Test_sc_file() 2249 filetype on 2250 2251 " SC classes are defined with '+ Class {}' 2252 call writefile(['+ SCNvim {', '*methodArgs {|method|'], 'srcfile.sc') 2253 split srcfile.sc 2254 call assert_equal('supercollider', &filetype) 2255 bwipe! 2256 call delete('srcfile.sc') 2257 2258 " Some SC class files start with comment and define methods many lines later 2259 call writefile(['// Query', '//Method','^this {'], 'srcfile.sc') 2260 split srcfile.sc 2261 call assert_equal('supercollider', &filetype) 2262 bwipe! 2263 call delete('srcfile.sc') 2264 2265 " Some SC class files put comments between method declaration after class 2266 call writefile(['PingPong {', '//comment','*ar { arg'], 'srcfile.sc') 2267 split srcfile.sc 2268 call assert_equal('supercollider', &filetype) 2269 bwipe! 2270 call delete('srcfile.sc') 2271 2272 filetype off 2273 endfunc 2274 2275 " Test dist#ft#FTscd() 2276 func Test_scd_file() 2277 filetype on 2278 2279 call writefile(['ijq(1)'], 'srcfile.scd', 'D') 2280 split srcfile.scd 2281 call assert_equal('scdoc', &filetype) 2282 2283 bwipe! 2284 filetype off 2285 endfunc 2286 2287 func Test_src_file() 2288 filetype on 2289 2290 " KRL header start with "&WORD", but is not always present. 2291 call writefile(['&ACCESS'], 'srcfile.src') 2292 split srcfile.src 2293 call assert_equal('krl', &filetype) 2294 bwipe! 2295 call delete('srcfile.src') 2296 2297 " KRL def with leading spaces, for KRL file extension is not case sensitive. 2298 call writefile([' DEF srcfile()'], 'srcfile.Src') 2299 split srcfile.Src 2300 call assert_equal('krl', &filetype) 2301 bwipe! 2302 call delete('srcfile.Src') 2303 2304 " KRL global deffct with embedded spaces, file starts with empty line(s). 2305 for text in ['global def srcfile()', 'global deffct srcfile()'] 2306 call writefile(['', text], 'srcfile.SRC') 2307 split srcfile.SRC 2308 call assert_equal('krl', &filetype, text) 2309 bwipe! 2310 endfor 2311 2312 " User may overrule file inspection 2313 let g:filetype_src = 'src' 2314 split srcfile.SRC 2315 call assert_equal('src', &filetype) 2316 bwipe! 2317 call delete('srcfile.SRC') 2318 unlet g:filetype_src 2319 2320 filetype off 2321 endfunc 2322 2323 func Test_sys_file() 2324 filetype on 2325 2326 " *.sys defaults to Batch file for MSDOS 2327 call writefile(['looks like dos batch'], 'sysfile.sys') 2328 split sysfile.sys 2329 call assert_equal('bat', &filetype) 2330 bwipe! 2331 2332 " Users preference set by g:filetype_sys 2333 let g:filetype_sys = 'sys' 2334 split sysfile.sys 2335 call assert_equal('sys', &filetype) 2336 unlet g:filetype_sys 2337 bwipe! 2338 2339 " RAPID header start with a line containing only "%%%", 2340 " but is not always present. 2341 call writefile(['%%%'], 'sysfile.sys') 2342 split sysfile.sys 2343 call assert_equal('rapid', &filetype) 2344 bwipe! 2345 call delete('sysfile.sys') 2346 2347 " RAPID supports umlauts in module names, leading spaces, 2348 " the .sys extension is not case sensitive. 2349 call writefile([' module ÜmlautModule'], 'sysfile.Sys') 2350 split sysfile.Sys 2351 call assert_equal('rapid', &filetype) 2352 bwipe! 2353 call delete('sysfile.Sys') 2354 2355 " RAPID is not case sensitive, embedded spaces, sysmodule, 2356 " file starts with empty line(s). 2357 call writefile(['', 'MODULE rapidmödüle (SYSMODULE,NOSTEPIN)'], 'sysfile.SYS') 2358 split sysfile.SYS 2359 call assert_equal('rapid', &filetype) 2360 bwipe! 2361 call delete('sysfile.SYS') 2362 2363 filetype off 2364 endfunc 2365 2366 func Test_tex_file() 2367 filetype on 2368 2369 call writefile(['%& pdflatex'], 'Xfile.tex') 2370 split Xfile.tex 2371 call assert_equal('tex', &filetype) 2372 bwipe 2373 2374 call writefile(['\newcommand{\test}{some text}'], 'Xfile.tex') 2375 split Xfile.tex 2376 call assert_equal('tex', &filetype) 2377 bwipe 2378 2379 " tex_flavor is unset 2380 call writefile(['%& plain'], 'Xfile.tex') 2381 split Xfile.tex 2382 call assert_equal('plaintex', &filetype) 2383 bwipe 2384 2385 let g:tex_flavor = 'plain' 2386 call writefile(['just some text'], 'Xfile.tex') 2387 split Xfile.tex 2388 call assert_equal('plaintex', &filetype) 2389 bwipe 2390 2391 let lines =<< trim END 2392 % This is a comment. 2393 2394 \usemodule[translate] 2395 END 2396 call writefile(lines, 'Xfile.tex') 2397 split Xfile.tex 2398 call assert_equal('context', &filetype) 2399 bwipe 2400 2401 let g:tex_flavor = 'context' 2402 call writefile(['just some text'], 'Xfile.tex') 2403 split Xfile.tex 2404 call assert_equal('context', &filetype) 2405 bwipe 2406 unlet g:tex_flavor 2407 2408 call delete('Xfile.tex') 2409 filetype off 2410 endfunc 2411 2412 func Test_tf_file() 2413 filetype on 2414 2415 call writefile([';;; TF MUD client is super duper cool'], 'Xfile.tf', 'D') 2416 split Xfile.tf 2417 call assert_equal('tf', &filetype) 2418 bwipe! 2419 2420 call writefile(['provider "azurerm" {'], 'Xfile.tf') 2421 split Xfile.tf 2422 call assert_equal('terraform', &filetype) 2423 bwipe! 2424 2425 filetype off 2426 endfunc 2427 2428 func Test_tf_file_v2() 2429 filetype on 2430 2431 let lines =<< trim END 2432 ;# Connect to a MUD server 2433 /server mud.example.com 4000 2434 ;set verbose on 2435 /def greet = /echo Hello, $[name()] 2436 /def hp = /send score 2437 ;alias n = north 2438 ;alias s = south 2439 ;set autolog on 2440 /def prompt = /echo -p Prompt: %{*} 2441 END 2442 2443 call writefile(lines, "Xfile.tf", "D") 2444 split Xfile.tf 2445 call assert_equal('tf', &filetype) 2446 bw! 2447 let lines =<< trim END 2448 # This is a comment at the top of the file 2449 2450 terraform { 2451 required_version = ">= 1.0" 2452 } 2453 2454 provider "aws" { 2455 region = "us-east-1" 2456 } 2457 2458 resource "aws_s3_bucket" "demo" { 2459 bucket = "example-bucket" 2460 } 2461 END 2462 call writefile(lines, "Xfile.tf", "D") 2463 split Xfile.tf 2464 call assert_equal('terraform', &filetype) 2465 bwipe! 2466 2467 filetype off 2468 endfunc 2469 2470 2471 func Test_ts_file() 2472 filetype on 2473 2474 call writefile(['<?xml version="1.0" encoding="utf-8"?>'], 'Xfile.ts', 'D') 2475 split Xfile.ts 2476 call assert_equal('xml', &filetype) 2477 bwipe! 2478 2479 call writefile(['// looks like Typescript'], 'Xfile.ts') 2480 split Xfile.ts 2481 call assert_equal('typescript', &filetype) 2482 bwipe! 2483 2484 filetype off 2485 endfunc 2486 2487 func Test_ttl_file() 2488 filetype on 2489 2490 call writefile(['@base <http://example.org/> .'], 'Xfile.ttl', 'D') 2491 split Xfile.ttl 2492 call assert_equal('turtle', &filetype) 2493 bwipe! 2494 2495 call writefile(['looks like Tera Term Language'], 'Xfile.ttl') 2496 split Xfile.ttl 2497 call assert_equal('teraterm', &filetype) 2498 bwipe! 2499 2500 filetype off 2501 endfunc 2502 2503 func Test_v_file() 2504 filetype on 2505 2506 call writefile(['module tb; // Looks like a Verilog'], 'Xfile.v', 'D') 2507 split Xfile.v 2508 call assert_equal('verilog', &filetype) 2509 bwipe! 2510 2511 call writefile(['module main'], 'Xfile.v') 2512 split Xfile.v 2513 call assert_equal('v', &filetype) 2514 bwipe! 2515 2516 call writefile(['Definition x := 10. (*'], 'Xfile.v') 2517 split Xfile.v 2518 call assert_equal('coq', &filetype) 2519 bwipe! 2520 2521 filetype off 2522 endfunc 2523 2524 func Test_xpm_file() 2525 filetype on 2526 2527 call writefile(['this is XPM2'], 'file.xpm', 'D') 2528 split file.xpm 2529 call assert_equal('xpm2', &filetype) 2530 bwipe! 2531 2532 filetype off 2533 endfunc 2534 2535 func Test_cls_file() 2536 filetype on 2537 2538 call writefile(['looks like Smalltalk'], 'Xfile.cls', 'D') 2539 split Xfile.cls 2540 call assert_equal('st', &filetype) 2541 bwipe! 2542 2543 " Test dist#ft#FTcls() 2544 2545 let g:filetype_cls = 'vb' 2546 split Xfile.cls 2547 call assert_equal('vb', &filetype) 2548 bwipe! 2549 unlet g:filetype_cls 2550 2551 " TeX 2552 2553 call writefile(['%'], 'Xfile.cls') 2554 split Xfile.cls 2555 call assert_equal('tex', &filetype) 2556 bwipe! 2557 2558 call writefile(['\NeedsTeXFormat{LaTeX2e}'], 'Xfile.cls') 2559 split Xfile.cls 2560 call assert_equal('tex', &filetype) 2561 bwipe! 2562 2563 " Rexx 2564 2565 call writefile(['#!/usr/bin/rexx'], 'Xfile.cls') 2566 split Xfile.cls 2567 call assert_equal('rexx', &filetype) 2568 bwipe! 2569 2570 call writefile(['#!/usr/bin/regina'], 'Xfile.cls') 2571 split Xfile.cls 2572 call assert_equal('rexx', &filetype) 2573 bwipe! 2574 2575 call writefile(['/* Comment */'], 'Xfile.cls') 2576 split Xfile.cls 2577 call assert_equal('rexx', &filetype) 2578 bwipe! 2579 2580 call writefile(['::class Foo subclass Bar public'], 'Xfile.cls') 2581 split Xfile.cls 2582 call assert_equal('rexx', &filetype) 2583 bwipe! 2584 2585 " Visual Basic 2586 2587 call writefile(['VERSION 1.0 CLASS'], 'Xfile.cls') 2588 split Xfile.cls 2589 call assert_equal('vb', &filetype) 2590 bwipe! 2591 2592 filetype off 2593 endfunc 2594 2595 func Test_cmd_file() 2596 filetype on 2597 2598 call writefile(['--rom_model'], 'Xfile.cmd') 2599 split Xfile.cmd 2600 call assert_equal('lnk', &filetype) 2601 bwipe! 2602 2603 call writefile(['/* comment */'], 'Xfile.cmd') 2604 split Xfile.cmd 2605 call assert_equal('rexx', &filetype) 2606 bwipe! 2607 2608 call writefile(['REM comment'], 'Xfile.cmd') 2609 split Xfile.cmd 2610 call assert_equal('dosbatch', &filetype) 2611 bwipe! 2612 2613 filetype off 2614 endfunc 2615 2616 func Test_sa_file() 2617 filetype on 2618 2619 call writefile([';* XXX-a.sa: XXX for TI C6000 DSP *;', '.no_mdep'], 'Xfile.sa') 2620 split Xfile.sa 2621 call assert_equal('tiasm', &filetype) 2622 bwipe! 2623 2624 call writefile(['-- comment'], 'Xfile.sa') 2625 split Xfile.sa 2626 call assert_equal('sather', &filetype) 2627 bwipe! 2628 2629 filetype off 2630 endfunc 2631 2632 func Test_sig_file() 2633 filetype on 2634 2635 call writefile(['this is neither Lambda Prolog nor SML'], 'Xfile.sig', 'D') 2636 split Xfile.sig 2637 call assert_equal('', &filetype) 2638 bwipe! 2639 2640 " Test dist#ft#FTsig() 2641 2642 let g:filetype_sig = 'sml' 2643 split Xfile.sig 2644 call assert_equal('sml', &filetype) 2645 bwipe! 2646 unlet g:filetype_sig 2647 2648 " Lambda Prolog 2649 2650 call writefile(['sig foo.'], 'Xfile.sig') 2651 split Xfile.sig 2652 call assert_equal('lprolog', &filetype) 2653 bwipe! 2654 2655 call writefile(['/* ... */'], 'Xfile.sig') 2656 split Xfile.sig 2657 call assert_equal('lprolog', &filetype) 2658 bwipe! 2659 2660 call writefile(['% ...'], 'Xfile.sig') 2661 split Xfile.sig 2662 call assert_equal('lprolog', &filetype) 2663 bwipe! 2664 2665 " SML signature file 2666 2667 call writefile(['signature FOO ='], 'Xfile.sig') 2668 split Xfile.sig 2669 call assert_equal('sml', &filetype) 2670 bwipe! 2671 2672 call writefile(['structure FOO ='], 'Xfile.sig') 2673 split Xfile.sig 2674 call assert_equal('sml', &filetype) 2675 bwipe! 2676 2677 call writefile(['(* ... *)'], 'Xfile.sig') 2678 split Xfile.sig 2679 call assert_equal('sml', &filetype) 2680 bwipe! 2681 2682 filetype off 2683 endfunc 2684 2685 " Test dist#ft#FTsil() 2686 func Test_sil_file() 2687 filetype on 2688 2689 split Xfile.sil 2690 call assert_equal('sil', &filetype) 2691 bwipe! 2692 2693 let lines =<< trim END 2694 // valid 2695 let protoErasedPathA = \ABCProtocol.a 2696 2697 // also valid 2698 let protoErasedPathA = 2699 \ABCProtocol.a 2700 END 2701 call writefile(lines, 'Xfile.sil', 'D') 2702 2703 split Xfile.sil 2704 call assert_equal('sil', &filetype) 2705 bwipe! 2706 2707 " SILE 2708 2709 call writefile(['% some comment'], 'Xfile.sil') 2710 split Xfile.sil 2711 call assert_equal('sile', &filetype) 2712 bwipe! 2713 2714 call writefile(['\begin[papersize=a6]{document}foo\end{document}'], 'Xfile.sil') 2715 split Xfile.sil 2716 call assert_equal('sile', &filetype) 2717 bwipe! 2718 2719 filetype off 2720 endfunc 2721 2722 func Test_inc_file() 2723 filetype on 2724 2725 call writefile(['this is the fallback'], 'Xfile.inc', 'D') 2726 split Xfile.inc 2727 call assert_equal('pov', &filetype) 2728 bwipe! 2729 2730 let g:filetype_inc = 'foo' 2731 split Xfile.inc 2732 call assert_equal('foo', &filetype) 2733 bwipe! 2734 unlet g:filetype_inc 2735 2736 " aspperl 2737 call writefile(['perlscript'], 'Xfile.inc') 2738 split Xfile.inc 2739 call assert_equal('aspperl', &filetype) 2740 bwipe! 2741 2742 " aspvbs 2743 call writefile(['<% something'], 'Xfile.inc') 2744 split Xfile.inc 2745 call assert_equal('aspvbs', &filetype) 2746 bwipe! 2747 2748 " php 2749 call writefile(['<?php'], 'Xfile.inc') 2750 split Xfile.inc 2751 call assert_equal('php', &filetype) 2752 bwipe! 2753 2754 " pascal 2755 call writefile(['program'], 'Xfile.inc') 2756 split Xfile.inc 2757 call assert_equal('pascal', &filetype) 2758 bwipe! 2759 2760 " bitbake 2761 call writefile(['require foo'], 'Xfile.inc') 2762 split Xfile.inc 2763 call assert_equal('bitbake', &filetype) 2764 bwipe! 2765 2766 call writefile(['S = "${WORKDIR}"'], 'Xfile.inc') 2767 split Xfile.inc 2768 call assert_equal('bitbake', &filetype) 2769 bwipe! 2770 2771 call writefile(['DEPENDS:append = " somedep"'], 'Xfile.inc') 2772 split Xfile.inc 2773 call assert_equal('bitbake', &filetype) 2774 bwipe! 2775 2776 call writefile(['MACHINE ??= "qemu"'], 'Xfile.inc') 2777 split Xfile.inc 2778 call assert_equal('bitbake', &filetype) 2779 bwipe! 2780 2781 call writefile(['PROVIDES := "test"'], 'Xfile.inc') 2782 split Xfile.inc 2783 call assert_equal('bitbake', &filetype) 2784 bwipe! 2785 2786 call writefile(['RDEPENDS_${PN} += "bar"'], 'Xfile.inc') 2787 split Xfile.inc 2788 call assert_equal('bitbake', &filetype) 2789 bwipe! 2790 2791 call writefile(['PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"'], 'Xfile.inc') 2792 split Xfile.inc 2793 call assert_equal('bitbake', &filetype) 2794 bwipe! 2795 2796 call writefile(['MACHINEOVERRIDES =. "qemuall:"'], 'Xfile.inc') 2797 split Xfile.inc 2798 call assert_equal('bitbake', &filetype) 2799 bwipe! 2800 2801 call writefile(['BBPATH .= ":${LAYERDIR}"'], 'Xfile.inc') 2802 split Xfile.inc 2803 call assert_equal('bitbake', &filetype) 2804 bwipe! 2805 2806 " asm 2807 call writefile(['asmsyntax=foo'], 'Xfile.inc') 2808 split Xfile.inc 2809 call assert_equal('foo', &filetype) 2810 bwipe! 2811 2812 filetype off 2813 endfunc 2814 2815 func Test_ll_file() 2816 filetype on 2817 2818 " LLVM IR 2819 call writefile(['target triple = "nvptx64-nvidia-cuda"'], 'Xfile.ll', 'D') 2820 split Xfile.ll 2821 call assert_equal('llvm', &filetype) 2822 bwipe! 2823 2824 " lex (C++) 2825 call writefile(['%{', '#include <iostream>', '%}'], 'Xfile.ll', 'D') 2826 split Xfile.ll 2827 call assert_equal('lex', &filetype) 2828 bwipe! 2829 2830 " lifelines 2831 call writefile(['proc main() {}'], 'Xfile.ll', 'D') 2832 split Xfile.ll 2833 call assert_equal('lifelines', &filetype) 2834 bwipe! 2835 2836 filetype off 2837 endfunc 2838 2839 func Test_lsl_file() 2840 filetype on 2841 2842 call writefile(['looks like Linden Scripting Language'], 'Xfile.lsl', 'D') 2843 split Xfile.lsl 2844 call assert_equal('lsl', &filetype) 2845 bwipe! 2846 2847 " Test dist#ft#FTlsl() 2848 2849 let g:filetype_lsl = 'larch' 2850 split Xfile.lsl 2851 call assert_equal('larch', &filetype) 2852 bwipe! 2853 unlet g:filetype_lsl 2854 2855 " Larch Shared Language 2856 2857 call writefile(['% larch comment'], 'Xfile.lsl') 2858 split Xfile.lsl 2859 call assert_equal('larch', &filetype) 2860 bwipe! 2861 2862 call writefile(['foo: trait'], 'Xfile.lsl') 2863 split Xfile.lsl 2864 call assert_equal('larch', &filetype) 2865 bwipe! 2866 2867 filetype off 2868 endfunc 2869 2870 func Test_typ_file() 2871 filetype on 2872 2873 " SQL type file 2874 2875 call writefile(['CASE = LOWER'], 'Xfile.typ', 'D') 2876 split Xfile.typ 2877 call assert_equal('sql', &filetype) 2878 bwipe! 2879 2880 call writefile(['TYPE foo'], 'Xfile.typ') 2881 split Xfile.typ 2882 call assert_equal('sql', &filetype) 2883 bwipe! 2884 2885 " typst document 2886 2887 call writefile(['this is a fallback'], 'Xfile.typ') 2888 split Xfile.typ 2889 call assert_equal('typst', &filetype) 2890 bwipe! 2891 2892 let g:filetype_typ = 'typst' 2893 split test.typ 2894 call assert_equal('typst', &filetype) 2895 bwipe! 2896 unlet g:filetype_typ 2897 2898 filetype off 2899 endfunc 2900 2901 func Test_dsp_file() 2902 filetype on 2903 2904 " Microsoft Developer Studio Project file 2905 2906 call writefile(['# Microsoft Developer Studio Project File'], 'Xfile.dsp', 'D') 2907 split Xfile.dsp 2908 call assert_equal('make', &filetype) 2909 bwipe! 2910 2911 let g:filetype_dsp = 'make' 2912 split test.dsp 2913 call assert_equal('make', &filetype) 2914 bwipe! 2915 unlet g:filetype_dsp 2916 2917 " Faust 2918 2919 call writefile(['this is a fallback'], 'Xfile.dsp') 2920 split Xfile.dsp 2921 call assert_equal('faust', &filetype) 2922 bwipe! 2923 2924 filetype off 2925 endfunc 2926 2927 func Test_vba_file() 2928 filetype on 2929 2930 " Test dist#ft#FTvba() 2931 2932 " Visual Basic 2933 2934 call writefile(['looks like Visual Basic'], 'Xfile.vba', 'D') 2935 split Xfile.vba 2936 call assert_equal('vb', &filetype) 2937 bwipe! 2938 2939 " Vimball Archiver (ft=vim) 2940 2941 call writefile(['" Vimball Archiver by Charles E. Campbell, Ph.D.', 'UseVimball', 'finish'], 'Xfile.vba', 'D') 2942 split Xfile.vba 2943 call assert_equal('vim', &filetype) 2944 bwipe! 2945 2946 filetype off 2947 endfunc 2948 2949 func Test_i_file() 2950 filetype on 2951 2952 " Swig: keyword 2953 call writefile(['%module mymodule', '/* a comment */'], 'Xfile.i', 'D') 2954 split Xfile.i 2955 call assert_equal('swig', &filetype) 2956 bwipe! 2957 2958 " Swig: verbatim block 2959 call writefile(['%{', '#include <header.hpp>', '%}'], 'Xfile.i', 'D') 2960 split Xfile.i 2961 call assert_equal('swig', &filetype) 2962 bwipe! 2963 2964 " ASM 2965 call writefile(['; comment', ';'], 'Xfile.i', 'D') 2966 split Xfile.i 2967 call assert_equal('asm', &filetype) 2968 bwipe! 2969 2970 " *.i defaults to progress 2971 call writefile(['looks like progress'], 'Xfile.i', 'D') 2972 split Xfile.i 2973 call assert_equal('progress', &filetype) 2974 bwipe! 2975 2976 filetype off 2977 endfunc 2978 2979 func Test_def_file() 2980 filetype on 2981 2982 call writefile(['this is the fallback'], 'Xfile.def', 'D') 2983 split Xfile.def 2984 call assert_equal('def', &filetype) 2985 bwipe! 2986 2987 " Test dist#ft#FTdef() 2988 2989 let g:filetype_def = 'modula2' 2990 split Xfile.def 2991 call assert_equal('modula2', &filetype) 2992 call assert_equal('pim', b:modula2.dialect) 2993 bwipe! 2994 unlet g:filetype_def 2995 2996 " Modula-2 2997 2998 call writefile(['(* a Modula-2 comment *)'], 'Xfile.def') 2999 split Xfile.def 3000 call assert_equal('modula2', &filetype) 3001 call assert_equal('pim', b:modula2.dialect) 3002 bwipe! 3003 3004 call writefile(['IMPLEMENTATION MODULE Module2Mod;'], 'Xfile.def') 3005 split Xfile.def 3006 call assert_equal('modula2', &filetype) 3007 call assert_equal('pim', b:modula2.dialect) 3008 bwipe! 3009 3010 filetype off 3011 endfunc 3012 3013 func Test_uci_file() 3014 filetype on 3015 3016 call mkdir('any/etc/config', 'pR') 3017 call writefile(['config firewall'], 'any/etc/config/firewall', 'D') 3018 split any/etc/config/firewall 3019 call assert_equal('uci', &filetype) 3020 bwipe! 3021 3022 call writefile(['# config for nginx here'], 'any/etc/config/firewall', 'D') 3023 split any/etc/config/firewall 3024 call assert_notequal('uci', &filetype) 3025 bwipe! 3026 3027 call writefile(['# Copyright Cool Cats 1997', 'config firewall'], 'any/etc/config/firewall', 'D') 3028 split any/etc/config/firewall 3029 call assert_equal('uci', &filetype) 3030 bwipe! 3031 3032 filetype off 3033 endfunc 3034 3035 func Test_pro_file() 3036 filetype on 3037 3038 "Prolog 3039 call writefile([':-module(test/1,'], 'Xfile.pro', 'D') 3040 split Xfile.pro 3041 call assert_equal('prolog', &filetype) 3042 bwipe! 3043 3044 call writefile(['% comment'], 'Xfile.pro', 'D') 3045 split Xfile.pro 3046 call assert_equal('prolog', &filetype) 3047 bwipe! 3048 3049 call writefile(['/* multiline comment'], 'Xfile.pro', 'D') 3050 split Xfile.pro 3051 call assert_equal('prolog', &filetype) 3052 bwipe! 3053 3054 call writefile(['rule(test, 1.7).'], 'Xfile.pro', 'D') 3055 split Xfile.pro 3056 call assert_equal('prolog', &filetype) 3057 bwipe! 3058 3059 " IDL 3060 call writefile(['x = findgen(100)/10'], 'Xfile.pro', 'D') 3061 split Xfile.pro 3062 call assert_equal('idlang', &filetype) 3063 bwipe! 3064 3065 filetype off 3066 endfunc 3067 3068 3069 func Test_pl_file() 3070 filetype on 3071 3072 "Prolog 3073 call writefile([':-module(test/1,'], 'Xfile.pl', 'D') 3074 split Xfile.pl 3075 call assert_equal('prolog', &filetype) 3076 bwipe! 3077 3078 call writefile(['% comment'], 'Xfile.pl', 'D') 3079 split Xfile.pl 3080 call assert_equal('prolog', &filetype) 3081 bwipe! 3082 3083 call writefile(['/* multiline comment'], 'Xfile.pl', 'D') 3084 split Xfile.pl 3085 call assert_equal('prolog', &filetype) 3086 bwipe! 3087 3088 call writefile(['rule(test, 1.7).'], 'Xfile.pl', 'D') 3089 split Xfile.pl 3090 call assert_equal('prolog', &filetype) 3091 bwipe! 3092 3093 " Perl 3094 call writefile(['%data = (1, 2, 3);'], 'Xfile.pl', 'D') 3095 split Xfile.pl 3096 call assert_equal('perl', &filetype) 3097 bwipe! 3098 3099 filetype off 3100 endfunc 3101 3102 func Test_make_file() 3103 filetype on 3104 3105 " BSD Makefile 3106 call writefile([''], 'BSDmakefile', 'D') 3107 split BSDmakefile 3108 call assert_equal('bsd', get(b:, 'make_flavor', '')) 3109 bwipe! 3110 3111 call writefile(['.ifmake all', '.endif'], 'XMakefile.mak', 'D') 3112 split XMakefile.mak 3113 call assert_equal('bsd', get(b:, 'make_flavor', '')) 3114 bwipe! 3115 3116 " GNU Makefile 3117 call writefile([''], 'GNUmakefile', 'D') 3118 split GNUmakefile 3119 call assert_equal('gnu', get(b:, 'make_flavor', '')) 3120 bwipe! 3121 3122 call writefile(['ifeq ($(foo),foo)', 'endif'], 'XMakefile.mak', 'D') 3123 split XMakefile.mak 3124 call assert_equal('gnu', get(b:, 'make_flavor', '')) 3125 bwipe! 3126 3127 call writefile(['define foo', 'endef'], 'XMakefile.mak', 'D') 3128 split XMakefile.mak 3129 call assert_equal('gnu', get(b:, 'make_flavor', '')) 3130 bwipe! 3131 3132 call writefile(['vim := $(wildcard *.vim)'], 'XMakefile.mak', 'D') 3133 split XMakefile.mak 3134 call assert_equal('gnu', get(b:, 'make_flavor', '')) 3135 bwipe! 3136 3137 " Microsoft Makefile 3138 call writefile(['# Makefile for Windows', '!if "$(VIMDLL)" == "yes"'], 'XMakefile.mak', 'D') 3139 split XMakefile.mak 3140 call assert_equal('microsoft', get(b:, 'make_flavor', '')) 3141 bwipe! 3142 3143 " BSD or GNU 3144 call writefile(['# get the list of tests', 'include testdir/Make_all.mak'], 'XMakefile.mak', 'D') 3145 split XMakefile.mak 3146 call assert_notequal('microsoft', get(b:, 'make_flavor', '')) 3147 bwipe! 3148 3149 filetype off 3150 endfunc 3151 3152 func Test_map_file() 3153 filetype on 3154 3155 " TI linker map file 3156 call writefile(['******************************************************************************', ' TMS320C6x Linker Unix v7.4.24 ', '******************************************************************************'], 'Xfile.map', 'D') 3157 split Xfile.map 3158 call assert_equal('lnkmap', &filetype) 3159 bwipe! 3160 3161 " UMN mapserver config file 3162 call writefile(['MAP', 'NAME "local-demo"', 'END'], 'Xfile.map', 'D') 3163 split Xfile.map 3164 call assert_equal('map', &filetype) 3165 bwipe! 3166 3167 filetype off 3168 endfunc 3169 3170 func Test_nroff_file() 3171 filetype on 3172 3173 call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile.1', 'D') 3174 split Xfile.1 3175 call assert_equal('nroff', &filetype) 3176 bwipe! 3177 3178 call writefile(['.Dd $Mdocdate$', '.Dt "DETECTION TEST" "7"', '.Os'], 'Xfile.7', 'D') 3179 split Xfile.7 3180 call assert_equal('nroff', &filetype) 3181 bwipe! 3182 3183 call writefile(['''\" t'], 'Xfile.3p', 'D') 3184 split Xfile.3p 3185 call assert_equal('nroff', &filetype) 3186 bwipe! 3187 3188 call writefile(['. /etc/profile'], 'Xfile.1', 'D') 3189 split Xfile.1 3190 call assert_notequal('nroff', &filetype) 3191 bwipe! 3192 endfunc 3193 3194 func Test_org_file() 3195 filetype on 3196 3197 call writefile(['* org Headline', '*some bold text*', '/some italic text/'], 'Xfile.org', 'D') 3198 split Xfile.org 3199 call assert_equal('org', &filetype) 3200 bwipe! 3201 3202 filetype off 3203 endfunc 3204 3205 func Test_info_file() 3206 filetype on 3207 3208 call writefile(['File: coreutils.info, Node: Top, Next: Introduction, Up: (dir)'], 'Xfile', 'D') 3209 split Xfile 3210 call assert_equal('info', &filetype) 3211 bwipe! 3212 3213 filetype off 3214 endfunc 3215 3216 func Test_mail_file() 3217 filetype on 3218 3219 call writefile(['Return-path: <lgc@debian.home.arpa>'], 'Xfile', 'D') 3220 split Xfile 3221 call assert_equal('mail', &filetype) 3222 bwipe! 3223 3224 filetype off 3225 endfunc 3226 3227 func Test_terminfo_file() 3228 filetype on 3229 3230 call writefile(['# Reconstructed via infocmp from file: /etc/terminfo/x/xterm'], 'Xfile', 'D') 3231 split Xfile 3232 call assert_equal('terminfo', &filetype) 3233 bwipe! 3234 3235 filetype off 3236 endfunc 3237 3238 " Filetypes detected from names of existing files 3239 func Test_pacmanlog() 3240 filetype on 3241 for fname in ['pacman.log', 'pacman.log.1', 'pacman.log-20250123'] 3242 call writefile(["[2025-01-23T01:23:45+0000] [PACMAN] Running 'pacman -S -y --config /etc/pacman.conf --'"], fname, 'D') 3243 exe 'split ' .. fname 3244 call assert_equal('pacmanlog', &filetype, 'for text: ' .. string(fname)) 3245 bwipe! 3246 endfor 3247 filetype off 3248 endfunc 3249 3250 func Test_diff_format() 3251 filetype on 3252 3253 call writefile(['0d555557 1 (John John 2025-01-01 00:00:00 +0000 1) foo'], 'Xdiff', 'D') 3254 split Xdiff 3255 call assert_true(empty(&filetype)) 3256 bwipe! 3257 3258 filetype off 3259 endfunc 3260 3261 func Test_m4_format() 3262 filetype on 3263 3264 call mkdir('Xm4', 'R') 3265 cd Xm4 3266 call writefile([''], 'alocal.m4') 3267 split alocal.m4 3268 call assert_equal('m4', &filetype) 3269 bwipe! 3270 " an accompanying configure.ac in the current directory changes the filetype 3271 call writefile([''], 'configure.ac') 3272 split alocal.m4 3273 call assert_equal('config', &filetype) 3274 bwipe! 3275 3276 cd - 3277 filetype off 3278 endfunc 3279 3280 " Erlang Application Resource File 3281 func Test_app_file() 3282 filetype on 3283 3284 call writefile(['% line comment', '{application, xfile1,'], 'xfile1.app', 'D') 3285 split xfile1.app 3286 call assert_equal('erlang', &filetype) 3287 bwipe! 3288 3289 call writefile(['% line comment', "{application, 'Xfile2',"], 'Xfile2.app', 'D') 3290 split Xfile2.app 3291 call assert_equal('erlang', &filetype) 3292 bwipe! 3293 3294 call writefile([' % line comment', 3295 \ ' ', 3296 \ ' % line comment', 3297 \ ' { ', 3298 \ ' % line comment ', 3299 \ ' application , ', 3300 \ ' % line comment ', 3301 \ ' xfile3 , '], 3302 \ 'xfile3.app', 'D') 3303 split xfile3.app 3304 call assert_equal('erlang', &filetype) 3305 bwipe! 3306 3307 filetype off 3308 endfunc 3309 3310 " vim: shiftwidth=2 sts=2 expandtab