Skip to main content

duat_filetype/
lib.rs

1//! Filetypes for the Duat text editor
2//!
3//! This [`Plugin`] is included by default, as it is considered a core
4//! utility of duat. It adds the two following traits:
5//!
6//! - [`FileType`]: This trait grants the [`filetype`] method, which
7//!   lets you access the filetype directly. Its implementors are the
8//!   [`Buffer`] widget, [`String`] and [`&str`] and [`PathBuf`] and
9//!   [`Path`].
10//! - [`PassFileType`]: This trait also has a
11//!   [`filetype`](PassFileType::filetype) method, but it requires a
12//!   [`Pass`], bypassing the need to, for example, [`read`] a
13//!   [`Handle<Buffer>`]. Its implementors are [`RwData<Buffer>`],
14//!   [`Handle<Buffer>`].
15//!
16//! [`Plugin`]: duat_core::Plugin
17//! [`filetype`]: FileType::filetype
18//! [`Buffer`]: duat_core::buffer::Buffer
19//! [`&str`]: str
20//! [`Pass`]: duat_core::data::Pass
21//! [`read`]: duat_core::context::Handle::read
22//! [`Handle<Buffer>`]: duat_core::context::Handle
23//! [`RwData<Buffer>`]: duat_core::data::RwData
24//! [hook]: duat_core::hook
25//! [`prelude`]: https://docs.rs/duat/latest/duat/prelude
26pub use prefixes::AutoPrefix;
27use std::{
28    collections::HashMap,
29    path::{Path, PathBuf},
30    sync::LazyLock,
31};
32
33use duat_core::{
34    buffer::Buffer,
35    context::Handle,
36    data::{Pass, RwData},
37    mode::Cursor,
38};
39use regex::RegexSet;
40
41mod prefixes;
42
43pub trait FileType {
44    fn filetype(&self) -> Option<&'static str>;
45}
46
47impl FileType for Buffer {
48    fn filetype(&self) -> Option<&'static str> {
49        PathBuf::from(self.path_set()?).filetype()
50    }
51}
52
53impl FileType for Cursor<'_> {
54    fn filetype(&self) -> Option<&'static str> {
55        self.widget().filetype()
56    }
57}
58
59impl FileType for String {
60    fn filetype(&self) -> Option<&'static str> {
61        AsRef::<str>::as_ref(&self).filetype()
62    }
63}
64
65impl FileType for &'_ str {
66    fn filetype(&self) -> Option<&'static str> {
67        Path::new(self).filetype()
68    }
69}
70
71impl FileType for PathBuf {
72    fn filetype(&self) -> Option<&'static str> {
73        self.as_path().filetype()
74    }
75}
76
77impl FileType for &'_ Path {
78    fn filetype(&self) -> Option<&'static str> {
79        self.extension()
80            .and_then(|ext| EXTENSIONS.get(ext.to_str()?).copied())
81            .or_else(|| FILENAMES.get(self.to_str()?).copied())
82            .or_else(|| FILENAMES.get(self.file_name()?.to_str()?).copied())
83            .or_else(|| {
84                let (patterns, langs) = &*PATTERNS;
85
86                langs
87                    .get(patterns.matches(self.to_str()?).iter().min()?)
88                    .copied()
89            })
90    }
91}
92
93pub trait PassFileType {
94    fn filetype(&self, pa: &Pass) -> Option<&'static str>;
95}
96
97impl PassFileType for RwData<Buffer> {
98    fn filetype(&self, pa: &Pass) -> Option<&'static str> {
99        self.read(pa).filetype()
100    }
101}
102
103impl PassFileType for Handle<Buffer> {
104    fn filetype(&self, pa: &Pass) -> Option<&'static str> {
105        self.read(pa).filetype()
106    }
107}
108
109macro_rules! fmt{
110    ($($tt:tt)*) => {{
111        let str: &'static str = format!($($tt)*).leak();
112        str
113    }}
114}
115
116static EXTENSIONS: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
117    HashMap::from_iter([
118        ("8th", "8th"),
119        ("a65", "a65"),
120        ("aap", "aap"),
121        ("abap", "abap"),
122        ("abc", "abc"),
123        ("abl", "abel"),
124        ("abnf", "abnf"),
125        ("wrm", "acedb"),
126        ("ads", "ada"),
127        ("ada", "ada"),
128        ("gpr", "ada"),
129        ("adb", "ada"),
130        ("tdf", "ahdl"),
131        ("aidl", "aidl"),
132        ("aml", "aml"),
133        ("run", "ampl"),
134        ("g4", "antlr4"),
135        ("scpt", "applescript"),
136        ("ino", "arduino"),
137        ("pde", "arduino"),
138        ("art", "art"),
139        ("asciidoc", "asciidoc"),
140        ("adoc", "asciidoc"),
141        ("asa", "aspvbs"),
142        // TODO: implement detection of other asm syntax
143        ("asm", "asm"),
144        ("s", "asm"),
145        ("S", "asm"),
146        ("a", "asm"),
147        ("A", "asm"),
148        ("lst", "asm"),
149        ("mac", "asm"),
150        ("asn1", "asn"),
151        ("asn", "asn"),
152        // TODO: implement detection of Active Server Pages
153        ("asp", "aspvbs"),
154        ("astro", "astro"),
155        ("asy", "asy"),
156        ("atl", "atlas"),
157        ("as", "atlas"),
158        ("zed", "authzed"),
159        ("ahk", "autohotkey"),
160        ("au3", "autoit"),
161        ("ave", "ave"),
162        ("gawk", "awk"),
163        ("awk", "awk"),
164        ("ref", "b"),
165        ("imp", "b"),
166        ("mch", "b"),
167        // TODO: implement detection of basic (for WHOM???)
168        ("bas", "basic"),
169        ("bass", "bass"),
170        ("bi", "basic"),
171        ("bm", "basic"),
172        ("bc", "bc"),
173        ("bdf", "bdf"),
174        ("beancount", "beancount"),
175        ("bib", "bib"),
176        // TODO: bindzone detection or wtv
177        ("com", "dcl"),
178        ("db", "bindzone"),
179        ("bicep", "bicep"),
180        ("bicepparam", "bicep"),
181        ("zone", "bindzone"),
182        ("bb", "bitbake"),
183        ("bbappend", "bitbake"),
184        ("bbclass", "bitbake"),
185        ("bl", "blank"),
186        ("blp", "blueprint"),
187        ("bp", "bp"),
188        ("bsd", "bsdl"),
189        ("bsdl", "bsdl"),
190        ("bst", "bst"),
191        // TODO: dosbatch detection
192        ("btm", "btm"),
193        ("bzl", "bzl"),
194        ("bazel", "bzl"),
195        ("BUILD", "bzl"),
196        ("mdh", "c"),
197        ("epro", "c"),
198        ("qc", "c"),
199        ("c3", "c3"),
200        ("c3i", "c3"),
201        ("c3t", "c3"),
202        ("cabal", "cabal"),
203        ("cairo", "cairo"),
204        ("capnp", "capnp"),
205        ("cdc", "cdc"),
206        ("cdl", "cdl"),
207        // TODO: Biased for tex, ngl
208        ("toc", "tex"),
209        ("cedar", "cedar"),
210        ("cfc", "cf"),
211        ("cfm", "cf"),
212        ("cfi", "cf"),
213        ("hgrc", "cfg"),
214        // TODO: Other meanings for cfg, i guess
215        ("cfg", "cfg"),
216        ("Cfg", "cfg"),
217        ("CFG", "cfg"),
218        ("chf", "ch"),
219        ("chai", "chaiscript"),
220        // TODO: change, ch, et. all
221        ("ch", "chill"),
222        ("chs", "chaskell"),
223        ("chatito", "chatito"),
224        ("chopro", "chordpro"),
225        ("crd", "chordpro"),
226        ("crdpro", "chordpro"),
227        ("cho", "chordpro"),
228        ("chordpro", "chordpro"),
229        ("ck", "chuck"),
230        // TODO: detect opencl
231        ("cl", "lisp"),
232        ("eni", "cl"),
233        ("icl", "clean"),
234        ("cljx", "clojure"),
235        ("clj", "clojure"),
236        ("cljc", "clojure"),
237        ("cljs", "clojure"),
238        ("cook", "cook"),
239        ("cmake", "cmake"),
240        ("cmod", "cmod"),
241        ("cob", "cobol"),
242        ("cbl", "cobol"),
243        ("atg", "coco"),
244        ("recipe", "conaryrecipe"),
245        ("ctags", "conf"),
246        // TODO: nil-ing, i guess?
247        ("hook", "confini"),
248        ("nmconnection", "confini"),
249        ("mklx", "context"),
250        ("mkiv", "context"),
251        ("mkii", "context"),
252        ("mkxl", "context"),
253        ("mkvi", "context"),
254        // TODO: nil-ing, i guess?
255        ("control", "debcontrol"),
256        // TODO: nil-ing, i guess?
257        ("copyright", "debcopyright"),
258        ("corn", "corn"),
259        // TODO: other types of csh
260        ("csh", "csh"),
261        ("cpon", "cpon"),
262        ("moc", "cpp"),
263        ("hh", "cpp"),
264        ("tlh", "cpp"),
265        ("inl", "cpp"),
266        ("ipp", "cpp"),
267        ("c++", "cpp"),
268        ("C", "cpp"),
269        ("cxx", "cpp"),
270        ("H", "cpp"),
271        ("tcc", "cpp"),
272        ("hxx", "cpp"),
273        ("hpp", "cpp"),
274        ("ixx", "cpp"),
275        ("mpp", "cpp"),
276        ("ccm", "cpp"),
277        ("cppm", "cpp"),
278        ("cxxm", "cpp"),
279        ("c++m", "cpp"),
280        // TODO: Whatever the hell is cynlib
281        ("cpp", "cpp"),
282        ("cc", "cpp"),
283        ("cql", "cqlang"),
284        ("crm", "crm"),
285        ("cr", "crystal"),
286        ("cake", "cs"),
287        ("csx", "cs"),
288        ("cs", "cs"),
289        ("csc", "csc"),
290        ("csdl", "csdl"),
291        ("cshtml", "html"),
292        ("fdr", "csp"),
293        ("csp", "csp"),
294        ("css", "css"),
295        ("csv", "csv"),
296        ("con", "cterm"),
297        ("feature", "cucumber"),
298        ("cuh", "cuda"),
299        ("cu", "cuda"),
300        ("cue", "cue"),
301        ("pld", "cupl"),
302        ("si", "cuplsim"),
303        ("cyn", "cynpp"),
304        ("cypher", "cypher"),
305        ("dfy", "dafny"),
306        ("dart", "dart"),
307        ("drt", "dart"),
308        ("ds", "datascript"),
309        // TODO: Idek what the main one is tbh
310        ("dat", "upstreamdat"),
311        ("Dat", "upstreamdat"),
312        ("DAT", "upstreamdat"),
313        ("dax", "dax"),
314        ("dcd", "dcd"),
315        // TODO: nil-ing i guess?
316        ("decl", "sgmldecl"),
317        ("dec", "sgmldecl"),
318        // TODO: Possibly decl
319        ("dcl", "clean"),
320        // TODO: Could be tex
321        ("def", "def"),
322        ("desc", "desc"),
323        ("directory", "desktop"),
324        ("desktop", "desktop"),
325        ("dhall", "dhall"),
326        ("diff", "diff"),
327        ("rej", "diff"),
328        ("Dockerfile", "dockerfile"),
329        ("dockerfile", "dockerfile"),
330        ("bat", "dosbatch"),
331        ("wrap", "dosini"),
332        ("ini", "dosini"),
333        ("INI", "dosini"),
334        ("vbp", "dosini"),
335        ("dot", "dot"),
336        ("gv", "dot"),
337        ("drac", "dracula"),
338        ("drc", "dracula"),
339        ("lvs", "dracula"),
340        ("lpe", "dracula"),
341        // TODO: Could be faust
342        ("dsp", "make"),
343        ("dtd", "dtd"),
344        // TODO: Could be dtrace
345        ("d", "d"),
346        ("dts", "dts"),
347        ("dtsi", "dts"),
348        ("dtso", "dts"),
349        ("its", "dts"),
350        ("keymap", "dts"),
351        ("overlay", "dts"),
352        ("dylan", "dylan"),
353        ("intr", "dylanintr"),
354        ("lid", "dylanlid"),
355        // TODO: could be specman
356        ("e", "eiffel"),
357        ("E", "eiffel"),
358        ("ecd", "ecd"),
359        ("edf", "edif"),
360        ("edif", "edif"),
361        ("edo", "edif"),
362        // TODO: could be edif
363        ("edn", "closure"),
364        ("eex", "eelixir"),
365        ("leex", "eelixir"),
366        ("am", "elf"),
367        ("exs", "elixir"),
368        ("elm", "elm"),
369        ("lc", "elsa"),
370        ("elv", "elvish"),
371        // TODO: could be cl
372        ("ent", "dtd"),
373        ("epp", "epuppet"),
374        ("erl", "erlang"),
375        ("hrl", "erlang"),
376        ("yaws", "erlang"),
377        ("erb", "eruby"),
378        ("rhtml", "eruby"),
379        ("esdl", "esdl"),
380        ("ec", "esqlc"),
381        ("EC", "esqlc"),
382        ("strl", "esterel"),
383        // TODO: detect other euphorias
384        ("eu", "euphoria3"),
385        ("EU", "euphoria3"),
386        ("ew", "euphoria3"),
387        ("EW", "euphoria3"),
388        ("EX", "euphoria3"),
389        ("exu", "euphoria3"),
390        ("EXU", "euphoria3"),
391        ("exw", "euphoria3"),
392        ("EXW", "euphoria3"),
393        // TODO: could be euphoria
394        ("ex", "elixir"),
395        ("exp", "expect"),
396        // TODO: could be forth
397        ("f", "fortran"),
398        ("factor", "factor"),
399        ("fal", "falcon"),
400        ("fan", "fan"),
401        ("fwt", "fan"),
402        ("lib", "faust"),
403        ("fnl", "fennel"),
404        ("m4gl", "fgl"),
405        ("4gl", "fgl"),
406        ("4gh", "fgl"),
407        ("fir", "firrtl"),
408        ("fish", "fish"),
409        ("focexec", "focexec"),
410        ("fex", "focexec"),
411        ("ft", "forth"),
412        ("fth", "forth"),
413        ("4th", "forth"),
414        ("FOR", "fortran"),
415        ("f77", "fortran"),
416        ("f03", "fortran"),
417        ("fortran", "fortran"),
418        ("F95", "fortran"),
419        ("f90", "fortran"),
420        ("F03", "fortran"),
421        ("fpp", "fortran"),
422        ("FTN", "fortran"),
423        ("ftn", "fortran"),
424        ("for", "fortran"),
425        ("F90", "fortran"),
426        ("F77", "fortran"),
427        ("f95", "fortran"),
428        ("FPP", "fortran"),
429        ("F", "fortran"),
430        ("F08", "fortran"),
431        ("f08", "fortran"),
432        ("fpc", "fpcmake"),
433        ("fsl", "framescript"),
434        // TODO: could be vb
435        ("frm", "form"),
436        ("fb", "freebasic"),
437        ("fs", "fortran"),
438        ("fsh", "fsh"),
439        ("fsi", "fsharp"),
440        ("fsx", "fsharp"),
441        ("fc", "func"),
442        ("fusion", "fusion"),
443        ("gdb", "gdb"),
444        ("gdmo", "gdmo"),
445        ("mo", "gdmo"),
446        ("tscn", "gdresource"),
447        ("tres", "gdresource"),
448        ("gd", "gdscript"),
449        ("gdshader", "gdshader"),
450        ("shader", "gdshader"),
451        ("ged", "gedcom"),
452        ("gel", "gel"),
453        ("gmi", "gemtext"),
454        ("gemini", "gemtext"),
455        ("gift", "gift"),
456        ("prettierignore", "gitignore"),
457        ("gleam", "gleam"),
458        ("vert", "glsl"),
459        ("tesc", "glsl"),
460        ("tese", "glsl"),
461        ("glsl", "glsl"),
462        ("geom", "glsl"),
463        ("frag", "glsl"),
464        ("comp", "glsl"),
465        ("rgen", "glsl"),
466        ("rmiss", "glsl"),
467        ("rchit", "glsl"),
468        ("rahit", "glsl"),
469        ("rint", "glsl"),
470        ("rcall", "glsl"),
471        ("gn", "gn"),
472        ("gni", "gn"),
473        ("gnuplot", "gnuplot"),
474        ("gpi", "gnuplot"),
475        ("go", "go"),
476        ("gp", "gp"),
477        ("gs", "grads"),
478        ("gql", "graphql"),
479        ("graphql", "graphql"),
480        ("graphqls", "graphql"),
481        ("gretl", "gretl"),
482        ("gradle", "groovy"),
483        ("groovy", "groovy"),
484        ("gsp", "gsp"),
485        ("gjs", "javascript.glimmer"),
486        ("gts", "typescript.glimmer"),
487        ("gyp", "gyp"),
488        ("gypi", "gyp"),
489        ("hack", "hack"),
490        ("hackpartial", "hack"),
491        ("haml", "haml"),
492        ("hsm", "hamster"),
493        ("hbs", "handlebars"),
494        ("ha", "hare"),
495        ("hs-boot", "haskell"),
496        ("hsig", "haskell"),
497        ("hsc", "haskell"),
498        ("hs", "haskell"),
499        ("persistentmodels", "haskellpersistent"),
500        ("ht", "haste"),
501        ("htpp", "hastepreproc"),
502        ("hcl", "hcl"),
503        ("hb", "hb"),
504        // TODO: could be various other c clones
505        ("h", "c"),
506        ("sum", "hercules"),
507        ("errsum", "hercules"),
508        ("ev", "hercules"),
509        ("vc", "hercules"),
510        ("heex", "heex"),
511        ("hex", "hex"),
512        ("a43", "hex"),
513        ("a90", "hex"),
514        ("h32", "hex"),
515        ("h80", "hex"),
516        ("h86", "hex"),
517        ("ihex", "hex"),
518        ("ihe", "hex"),
519        ("ihx", "hex"),
520        ("int", "hex"),
521        ("mcs", "hex"),
522        ("hjson", "hjson"),
523        ("m3u", "hlsplaylist"),
524        ("m3u8", "hlsplaylist"),
525        ("hog", "hog"),
526        ("hws", "hollywood"),
527        ("hoon", "hoon"),
528        // TODO: could be other flavors of html
529        ("cpt", "html"),
530        ("dtml", "html"),
531        ("htm", "html"),
532        ("html", "html"),
533        ("pt", "html"),
534        ("shtml", "html"),
535        ("stm", "html"),
536        ("htt", "httest"),
537        ("htb", "httest"),
538        ("http", "http"),
539        ("hurl", "hurl"),
540        // TODO: could be whatever the hell is virata
541        ("hw", "php"),
542        ("module", "php"),
543        ("pkg", "php"),
544        ("hy", "hy"),
545        ("iba", "ibasic"),
546        ("ibi", "ibasic"),
547        ("icn", "icon"),
548        // TODO: could be msidl
549        ("idl", "idl"),
550        ("idr", "idris2"),
551        // TODO: could be many things
552        ("inc", "php"),
553        ("inf", "inform"),
554        ("INF", "inform"),
555        ("ii", "initng"),
556        ("inko", "inko"),
557        // TODO: could be other things
558        ("inp", "tex"),
559        // TODO: could be xmath
560        ("ms", "nroff"),
561        ("ipkg", "ipkg"),
562        ("iss", "iss"),
563        ("mst", "ist"),
564        ("ist", "ist"),
565        ("ijs", "j"),
566        ("JAL", "jal"),
567        ("jal", "jal"),
568        ("jpr", "jam"),
569        ("jpl", "jam"),
570        ("janet", "janet"),
571        ("jav", "java"),
572        ("java", "java"),
573        ("jsh", "java"),
574        ("jj", "javacc"),
575        ("jjt", "javacc"),
576        ("es", "javascript"),
577        ("mjs", "javascript"),
578        ("javascript", "javascript"),
579        ("js", "javascript"),
580        ("jsm", "javascript"),
581        ("cjs", "javascript"),
582        ("jsx", "javascriptreact"),
583        ("clp", "jess"),
584        ("jgr", "jgraph"),
585        ("jinja", "jinja"),
586        ("jjdescription", "jjdescription"),
587        ("j73", "jovial"),
588        ("jov", "jovial"),
589        ("jovial", "jovial"),
590        ("properties", "jproperties"),
591        ("jq", "jq"),
592        ("slnf", "json"),
593        ("json", "json"),
594        ("jsonp", "json"),
595        ("geojson", "json"),
596        ("mcmeta", "json"),
597        ("webmanifest", "json"),
598        ("ipynb", "json"),
599        ("jupyterlab-settings", "json"),
600        ("sublime-project", "json"),
601        ("sublime-settings", "json"),
602        ("sublime-workspace", "json"),
603        ("json-patch", "json"),
604        ("bd", "json"),
605        ("bda", "json"),
606        ("xci", "json"),
607        ("json5", "json5"),
608        ("jsonc", "jsonc"),
609        ("jsonl", "jsonl"),
610        ("jsonnet", "jsonnet"),
611        ("libsonnet", "jsonnet"),
612        ("jsp", "jsp"),
613        ("jl", "julia"),
614        ("just", "just"),
615        ("Just", "just"),
616        ("JUST", "just"),
617        ("kl", "karel"),
618        ("KL", "karel"),
619        ("kdl", "kdl"),
620        ("kv", "kivy"),
621        ("kix", "kix"),
622        ("kts", "kotlin"),
623        ("kt", "kotlin"),
624        ("ktm", "kotlin"),
625        ("sub", "krl"),
626        ("Sub", "krl"),
627        ("SUB", "krl"),
628        ("ks", "kscript"),
629        ("k", "kwt"),
630        ("ACE", "lace"),
631        ("ace", "lace"),
632        ("lalrpop", "lalrpop"),
633        ("latte", "latte"),
634        ("lte", "latte"),
635        ("ld", "ld"),
636        ("ldif", "ldif"),
637        ("lean", "lean"),
638        ("journal", "ledger"),
639        ("ldg", "ledger"),
640        ("ledger", "ledger"),
641        ("leo", "leo"),
642        ("less", "less"),
643        ("lex", "lex"),
644        ("lxx", "lex"),
645        ("l++", "lex"),
646        ("l", "lex"),
647        ("lhs", "lhaskell"),
648        ("lidr", "lidris2"),
649        ("ly", "lilypond"),
650        ("ily", "lilypond"),
651        ("liquid", "liquid"),
652        ("liq", "liquidsoap"),
653        ("L", "lisp"),
654        ("lisp", "lisp"),
655        ("el", "lisp"),
656        ("lsp", "lisp"),
657        ("asd", "lisp"),
658        ("lt", "lite"),
659        ("lite", "lite"),
660        ("livemd", "livebook"),
661        // TODO: could be lifelines
662        ("ll", "llvm"),
663        // TODO: could be other things
664        ("log", "upstreamlog"),
665        ("Log", "upstreamlog"),
666        ("LOG", "upstreamlog"),
667        ("lgt", "logtalk"),
668        ("lotos", "lotos"),
669        // TODO: could be lotos
670        ("lot", "tex"),
671        ("lout", "lout"),
672        ("lou", "lout"),
673        ("ulpc", "lpc"),
674        ("lpc", "lpc"),
675        // TODO: could be lpc
676        ("c", "c"),
677        // TODO: could be larch
678        ("lsl", "lsl"),
679        ("lss", "lss"),
680        ("nse", "lua"),
681        ("rockspec", "lua"),
682        ("lua", "lua"),
683        ("tlu", "lua"),
684        ("luau", "luau"),
685        ("lrc", "lyrics"),
686        // TODO: one of the most ambiguous ones
687        ("m", "matlab"),
688        ("at", "m4"),
689        // TODO: could be msmessages
690        ("mc", "m4"),
691        ("quake", "m3quake"),
692        // TODO: idek
693        ("m4", "m4"),
694        ("eml", "mail"),
695        // TODO: could be other flavors of make
696        ("mk", "make"),
697        ("mak", "make"),
698        ("page", "mallard"),
699        // TODO: could be lnkmap
700        ("map", "map"),
701        ("mws", "maple"),
702        ("mpl", "maple"),
703        ("mv", "maple"),
704        // TODO: could be fake markdowns
705        ("mkdn", "markdown"),
706        ("md", "markdown"),
707        ("mdwn", "markdown"),
708        ("mkd", "markdown"),
709        ("markdown", "markdown"),
710        ("mdown", "markdown"),
711        ("masm", "masm"),
712        ("mhtml", "mason"),
713        ("mason", "mason"),
714        ("master", "master"),
715        ("mas", "master"),
716        ("demo", "maxima"),
717        ("dm1", "maxima"),
718        ("dm2", "maxima"),
719        ("dm3", "maxima"),
720        ("dmt", "maxima"),
721        ("wxm", "maxima"),
722        ("mbsyncrc", "mbsync"),
723        ("mw", "mediawiki"),
724        ("wiki", "mediawiki"),
725        ("mel", "mel"),
726        ("mmd", "mermaid"),
727        ("mmdc", "mermaid"),
728        ("mermaid", "mermaid"),
729        ("mf", "mf"),
730        ("mgl", "mgl"),
731        ("mgp", "mgp"),
732        ("my", "mib"),
733        ("mib", "mib"),
734        ("mix", "mix"),
735        ("mixal", "mix"),
736        ("mlir", "mlir"),
737        // TODO: could be nroff
738        ("mm", "objc"),
739        ("nb", "mma"),
740        ("wl", "mma"),
741        ("mmp", "mmp"),
742        // TODO: could be mmix
743        ("mms", "make"),
744        // TODO: could be many things
745        ("mod", "gomod"),
746        ("Mod", "gomod"),
747        ("MOD", "gomod"),
748        ("DEF", "modula2"),
749        ("m3", "modula3"),
750        ("i3", "modula3"),
751        ("mg", "modula3"),
752        ("ig", "modula3"),
753        ("lm3", "modula3"),
754        ("mojo", "mojo"),
755        ("🔥", "mojo"), // 🙄
756        ("ssc", "monk"),
757        ("monk", "monk"),
758        ("tsc", "monk"),
759        ("isc", "monk"),
760        ("moo", "moo"),
761        ("moon", "moonscript"),
762        ("move", "move"),
763        ("mp", "mp"),
764        // TODO: idek
765        ("mpiv", "mp"),
766        ("mpvi", "mp"),
767        ("mpxl", "mp"),
768        ("mof", "msidl"),
769        ("odl", "msidl"),
770        ("msql", "msql"),
771        ("mss", "mss"),
772        ("mu", "mupad"),
773        ("mush", "mush"),
774        ("mustache", "mustache"),
775        ("mysql", "mysql"),
776        ("n1ql", "n1ql"),
777        ("nql", "n1ql"),
778        ("nanorc", "nanorc"),
779        ("nasm", "nasm"),
780        ("NSA", "natural"),
781        ("NSC", "natural"),
782        ("NSG", "natural"),
783        ("NSL", "natural"),
784        ("NSM", "natural"),
785        ("NSN", "natural"),
786        ("NSP", "natural"),
787        ("NSS", "natural"),
788        ("ncf", "ncf"),
789        ("nginx", "nginx"),
790        ("nim", "nim"),
791        ("nims", "nim"),
792        ("nimble", "nim"),
793        ("ninja", "ninja"),
794        ("nix", "nix"),
795        ("norg", "norg"),
796        ("nqc", "nqc"),
797        // TODO: nil-ing i guess?
798        ("0", "nroff"),
799        ("1", "nroff"),
800        ("2", "nroff"),
801        ("3", "nroff"),
802        ("4", "nroff"),
803        ("5", "nroff"),
804        ("6", "nroff"),
805        ("7", "nroff"),
806        ("8", "nroff"),
807        ("9", "nroff"),
808        ("0p", "nroff"),
809        ("1p", "nroff"),
810        ("3p", "nroff"),
811        ("1x", "nroff"),
812        ("2x", "nroff"),
813        ("3x", "nroff"),
814        ("4x", "nroff"),
815        ("5x", "nroff"),
816        ("6x", "nroff"),
817        ("7x", "nroff"),
818        ("8x", "nroff"),
819        ("3am", "nroff"),
820        ("3perl", "nroff"),
821        ("3pm", "nroff"),
822        ("3posix", "nroff"),
823        ("3type", "nroff"),
824        ("n", "nroff"),
825        ("roff", "nroff"),
826        ("tmac", "nroff"),
827        ("man", "nroff"),
828        ("mom", "nroff"),
829        ("nr", "nroff"),
830        ("tr", "nroff"),
831        ("nsi", "nsis"),
832        ("nsh", "nsis"),
833        ("nt", "ntriples"),
834        ("nu", "nu"),
835        ("obj", "obj"),
836        ("objdump", "objdump"),
837        ("cppobjdump", "objdump"),
838        ("obl", "obse"),
839        ("obse", "obse"),
840        ("oblivion", "obse"),
841        ("obscript", "obse"),
842        ("mlt", "ocaml"),
843        ("mly", "ocaml"),
844        ("mll", "ocaml"),
845        ("mlp", "ocaml"),
846        ("mlip", "ocaml"),
847        ("mli", "ocaml"),
848        ("ml", "ocaml"),
849        ("occ", "occam"),
850        ("odin", "odin"),
851        ("xom", "omnimark"),
852        ("xin", "omnimark"),
853        ("opam", "opam"),
854        ("or", "openroad"),
855        ("scad", "openscad"),
856        ("ovpn", "openvpn"),
857        ("opl", "opl"),
858        ("opL", "opl"),
859        ("oPl", "opl"),
860        ("oPL", "opl"),
861        ("Opl", "opl"),
862        ("OpL", "opl"),
863        ("OPl", "opl"),
864        ("OPL", "opl"),
865        ("ora", "ora"),
866        ("org", "org"),
867        ("org_archive", "org"),
868        ("pandoc", "pandoc"),
869        ("pdk", "pandoc"),
870        ("pd", "pandoc"),
871        ("pdc", "pandoc"),
872        ("pxsl", "papp"),
873        ("papp", "papp"),
874        ("pxml", "papp"),
875        ("pas", "pascal"),
876        // TODO: could be pascal
877        ("lpr", "xml"),
878        ("dpr", "pascal"),
879        ("txtpb", "pbtxt"),
880        ("textproto", "pbtxt"),
881        ("textpb", "pbtxt"),
882        ("pbtxt", "pbtxt"),
883        ("g", "pccts"),
884        ("pcmk", "pcmk"),
885        ("pdf", "pdf"),
886        ("pem", "pem"),
887        ("cer", "pem"),
888        ("crt", "pem"),
889        ("csr", "pem"),
890        ("plx", "perl"),
891        ("prisma", "prisma"),
892        ("psgi", "perl"),
893        ("al", "perl"),
894        ("ctp", "php"),
895        ("php", "php"),
896        ("phpt", "php"),
897        ("php0", "php"),
898        ("php1", "php"),
899        ("php2", "php"),
900        ("php3", "php"),
901        ("php4", "php"),
902        ("php5", "php"),
903        ("php6", "php"),
904        ("php7", "php"),
905        ("php8", "php"),
906        ("php9", "php"),
907        ("phtml", "php"),
908        ("theme", "php"),
909        ("pike", "pike"),
910        ("pmod", "pike"),
911        ("rcp", "pilrc"),
912        // TODO: could be prolog
913        ("PL", "perl"),
914        ("pli", "pli"),
915        ("pl1", "pli"),
916        ("p36", "plm"),
917        ("plm", "plm"),
918        ("pac", "plm"),
919        ("plp", "plp"),
920        ("pls", "plsql"),
921        ("plsql", "plsql"),
922        ("po", "po"),
923        ("pot", "po"),
924        ("pod", "pod"),
925        ("filter", "poefilter"),
926        ("pk", "poke"),
927        ("pony", "pony"),
928        ("ps", "postscr"),
929        ("epsi", "postscr"),
930        ("afm", "postscr"),
931        ("epsf", "postscr"),
932        ("eps", "postscr"),
933        ("pfa", "postscr"),
934        ("ai", "postscr"),
935        ("pov", "pov"),
936        ("ppd", "ppd"),
937        ("it", "ppwiz"),
938        ("ih", "ppwiz"),
939        ("pq", "pq"),
940        ("action", "privoxy"),
941        // TODO: could be clipper
942        ("prg", "rapid"),
943        ("Prg", "rapid"),
944        ("PRG", "rapid"),
945        ("pc", "proc"),
946        ("pdb", "prolog"),
947        ("pml", "promela"),
948        ("proto", "proto"),
949        ("prql", "prql"),
950        ("psd1", "ps1"),
951        ("psm1", "ps1"),
952        ("ps1", "ps1"),
953        ("pssc", "ps1"),
954        ("ps1xml", "ps1xml"),
955        ("psf", "psf"),
956        ("psl", "psl"),
957        ("ptx", "ptx"),
958        ("pug", "pug"),
959        ("purs", "purescript"),
960        ("arr", "pyret"),
961        ("pxd", "pyrex"),
962        ("pxi", "pyrex"),
963        ("pyx", "pyrex"),
964        ("pyx+", "pyrex"),
965        ("pyw", "python"),
966        ("py", "python"),
967        ("pyi", "python"),
968        ("ptl", "python"),
969        ("ipy", "python"),
970        ("ql", "ql"),
971        ("qll", "ql"),
972        ("qml", "qml"),
973        ("qbs", "qml"),
974        ("qmd", "quarto"),
975        // TODO: could be other things
976        ("R", "r"),
977        ("rkt", "racket"),
978        ("rktd", "racket"),
979        ("rktl", "racket"),
980        ("rad", "radiance"),
981        ("mat", "radiance"),
982        ("pod6", "raku"),
983        ("rakudoc", "raku"),
984        ("rakutest", "raku"),
985        ("rakumod", "raku"),
986        ("pm6", "raku"),
987        ("raku", "raku"),
988        ("t6", "raku"),
989        ("p6", "raku"),
990        ("raml", "raml"),
991        ("sysx", "rapid"),
992        ("sysX", "rapid"),
993        ("Sysx", "rapid"),
994        ("SysX", "rapid"),
995        ("SYSX", "rapid"),
996        ("SYSx", "rapid"),
997        ("modx", "rapid"),
998        ("modX", "rapid"),
999        ("Modx", "rapid"),
1000        ("ModX", "rapid"),
1001        ("MODX", "rapid"),
1002        ("MODx", "rapid"),
1003        ("rasi", "rasi"),
1004        ("rbs", "rbs"),
1005        ("rego", "rego"),
1006        ("rem", "remind"),
1007        ("remind", "remind"),
1008        ("pip", "requirements"),
1009        ("res", "rescript"),
1010        ("resi", "rescript"),
1011        ("frt", "reva"),
1012        ("testUnit", "rexx"),
1013        ("rex", "rexx"),
1014        ("orx", "rexx"),
1015        ("rexx", "rexx"),
1016        ("jrexx", "rexx"),
1017        ("rxj", "rexx"),
1018        ("rexxj", "rexx"),
1019        ("testGroup", "rexx"),
1020        ("rxo", "rexx"),
1021        ("Rd", "rhelp"),
1022        ("rd", "rhelp"),
1023        ("rib", "rib"),
1024        ("Rmd", "rmd"),
1025        ("rmd", "rmd"),
1026        ("smd", "rmd"),
1027        ("Smd", "rmd"),
1028        ("rnc", "rnc"),
1029        ("rng", "rng"),
1030        ("rnw", "rnoweb"),
1031        ("snw", "rnoweb"),
1032        ("Rnw", "rnoweb"),
1033        ("Snw", "rnoweb"),
1034        ("robot", "robot"),
1035        ("resource", "robot"),
1036        ("roc", "roc"),
1037        ("ron", "ron"),
1038        ("rsc", "routeros"),
1039        ("x", "rpcgen"),
1040        ("rpgle", "rpgle"),
1041        ("rpgleinc", "rpgle"),
1042        ("rpl", "rpl"),
1043        ("Srst", "rrst"),
1044        ("srst", "rrst"),
1045        ("Rrst", "rrst"),
1046        ("rrst", "rrst"),
1047        ("rst", "rst"),
1048        ("rtf", "rtf"),
1049        ("rjs", "ruby"),
1050        ("rxml", "ruby"),
1051        ("rb", "ruby"),
1052        ("rant", "ruby"),
1053        ("ru", "ruby"),
1054        ("rbw", "ruby"),
1055        ("gemspec", "ruby"),
1056        ("builder", "ruby"),
1057        ("rake", "ruby"),
1058        ("rs", "rust"),
1059        // TODO: could be sather
1060        ("sa", "tiasm"),
1061        ("sage", "sage"),
1062        ("sls", "salt"),
1063        ("sas", "sas"),
1064        ("sass", "sass"),
1065        ("sbt", "sbt"),
1066        ("scala", "scala"),
1067        ("mill", "scala"),
1068        ("ss", "scheme"),
1069        ("scm", "scheme"),
1070        ("sld", "scheme"),
1071        ("stsg", "scheme"),
1072        ("sce", "scilab"),
1073        ("sci", "scilab"),
1074        ("scss", "scss"),
1075        ("sd", "sd"),
1076        ("sdc", "sdc"),
1077        ("pr", "sdl"),
1078        ("sdl", "sdl"),
1079        ("sed", "sed"),
1080        ("sexp", "sexplib"),
1081        // TODO: #! /bin/{other shells i asume}
1082        ("bash", "bash"),
1083        ("bats", "bash"),
1084        ("cygport", "bash"),
1085        ("ebuild", "bash"),
1086        ("eclass", "bash"),
1087        ("env", "bash"),
1088        ("envrc", "bash"),
1089        ("ksh", "ksh"),
1090        ("sh", "bash"),
1091        ("lo", "sh"),
1092        ("la", "sh"),
1093        ("lai", "sh"),
1094        ("mdd", "sh"),
1095        ("slang", "shaderslang"),
1096        ("sieve", "sieve"),
1097        ("siv", "sieve"),
1098        // TODO: could be lprolog
1099        ("sig", "sml"),
1100        // TODO: could be sile
1101        ("sil", "sil"),
1102        ("sim", "simula"),
1103        ("s85", "sinda"),
1104        ("sin", "sinda"),
1105        ("ssm", "sisu"),
1106        ("sst", "sisu"),
1107        ("ssi", "sisu"),
1108        ("_sst", "sisu"),
1109        ("-sst", "sisu"),
1110        ("il", "skill"),
1111        ("ils", "skill"),
1112        ("cdf", "skill"),
1113        ("sl", "slang"),
1114        ("ice", "slice"),
1115        ("slint", "slint"),
1116        ("score", "slrnsc"),
1117        ("sol", "solidity"),
1118        ("smali", "smali"),
1119        ("tpl", "smarty"),
1120        ("ihlp", "smcl"),
1121        ("smcl", "smcl"),
1122        ("hlp", "smcl"),
1123        ("smith", "smith"),
1124        ("smt", "smith"),
1125        ("smithy", "smithy"),
1126        ("sml", "sml"),
1127        ("smk", "snakemake"),
1128        ("spt", "snobol4"),
1129        ("sno", "snobol4"),
1130        ("sln", "solution"),
1131        ("sparql", "sparql"),
1132        ("rq", "sparql"),
1133        ("spec", "spec"),
1134        ("spice", "spice"),
1135        ("sp", "spice"),
1136        ("spd", "spup"),
1137        ("spdata", "spup"),
1138        ("speedup", "spup"),
1139        ("spi", "spyce"),
1140        ("spy", "spyce"),
1141        ("tyc", "sql"),
1142        // TODO: could be sql, but I'm biased
1143        ("typ", "typst"),
1144        ("pkb", "sql"),
1145        ("tyb", "sql"),
1146        ("pks", "sql"),
1147        ("sqlj", "sqlj"),
1148        ("sqi", "sqr"),
1149        ("sqr", "sqr"),
1150        ("nut", "squirrel"),
1151        // TODO: could be other things
1152        ("src", "krl"),
1153        ("Src", "krl"),
1154        ("SRC", "krl"),
1155        ("s28", "srec"),
1156        ("s37", "srec"),
1157        ("srec", "srec"),
1158        ("mot", "srec"),
1159        ("s19", "srec"),
1160        ("srt", "srt"),
1161        ("ssa", "ssa"),
1162        ("ass", "ssa"),
1163        ("st", "st"),
1164        ("ipd", "starlark"),
1165        ("star", "starlark"),
1166        ("starlark", "starlark"),
1167        ("imata", "stata"),
1168        ("do", "stata"),
1169        ("mata", "stata"),
1170        ("ado", "stata"),
1171        ("stp", "stp"),
1172        ("styl", "stylus"),
1173        ("stylus", "stylus"),
1174        ("quark", "supercollider"),
1175        ("sface", "surface"),
1176        ("svelte", "svelte"),
1177        ("svg", "svg"),
1178        ("sw", "sway"),
1179        ("swift", "swift"),
1180        ("swiftinterface", "swift"),
1181        ("swig", "swig"),
1182        ("swg", "swig"),
1183        // TODO: could be rapid
1184        ("sys", "bat"),
1185        ("Sys", "bat"),
1186        ("SYS", "bat"),
1187        ("svh", "systemverilog"),
1188        ("sv", "systemverilog"),
1189        ("cmm", "trace32"),
1190        ("cmmt", "trace32"),
1191        ("t32", "trace32"),
1192        ("td", "tablegen"),
1193        ("tak", "tak"),
1194        ("tal", "tal"),
1195        ("task", "taskedit"),
1196        ("tm", "tcl"),
1197        ("tcl", "tcl"),
1198        ("itk", "tcl"),
1199        ("itcl", "tcl"),
1200        ("tk", "tcl"),
1201        ("jacl", "tcl"),
1202        ("tl", "teal"),
1203        ("templ", "templ"),
1204        ("tmpl", "template"),
1205        ("tera", "tera"),
1206        ("ti", "terminfo"),
1207        ("dtx", "tex"),
1208        ("ltx", "tex"),
1209        ("bbl", "tex"),
1210        ("latex", "tex"),
1211        ("sty", "tex"),
1212        ("pgf", "tex"),
1213        ("nlo", "tex"),
1214        ("nls", "tex"),
1215        ("thm", "tex"),
1216        ("eps_tex", "tex"),
1217        ("pdf_tex", "tex"),
1218        ("pygtex", "tex"),
1219        ("pygstyle", "tex"),
1220        ("clo", "tex"),
1221        ("aux", "tex"),
1222        ("brf", "tex"),
1223        ("ind", "tex"),
1224        ("lof", "tex"),
1225        ("loe", "tex"),
1226        ("nav", "tex"),
1227        ("vrb", "tex"),
1228        ("ins", "tex"),
1229        ("tikz", "tex"),
1230        ("bbx", "tex"),
1231        ("cbx", "tex"),
1232        ("beamer", "tex"),
1233        // TODO: could be many things
1234        ("cls", "st"),
1235        ("texi", "texinfo"),
1236        ("txi", "texinfo"),
1237        ("texinfo", "texinfo"),
1238        ("text", "text"),
1239        ("tfvars", "terraform-vars"),
1240        ("thrift", "thrift"),
1241        ("tla", "tla"),
1242        ("tli", "tli"),
1243        ("toml", "toml"),
1244        ("tpp", "tpp"),
1245        ("treetop", "treetop"),
1246        ("trig", "trig"),
1247        ("slt", "tsalt"),
1248        ("tsscl", "tsscl"),
1249        ("tssgm", "tssgm"),
1250        ("tssop", "tssop"),
1251        ("tsv", "tsv"),
1252        ("tutor", "tutor"),
1253        ("twig", "twig"),
1254        // TODO: could be sql (greedy ahh language)
1255        ("ts", "typescript"),
1256        ("mts", "typescript"),
1257        ("cts", "typescript"),
1258        ("tsx", "typescriptreact"),
1259        ("tsp", "typespec"),
1260        ("uc", "uc"),
1261        ("uit", "uil"),
1262        ("uil", "uil"),
1263        ("ungram", "ungrammar"),
1264        ("u", "unison"),
1265        ("uu", "unison"),
1266        ("url", "urlshortcut"),
1267        ("usd", "usd"),
1268        ("usda", "usd"),
1269        // TODO: could be coq (🤤)
1270        ("v", "v"),
1271        ("vsh", "v"),
1272        ("vv", "v"),
1273        ("ctl", "vb"),
1274        ("dob", "vb"),
1275        ("dsm", "vb"),
1276        ("dsr", "vb"),
1277        ("pag", "vb"),
1278        ("sba", "vb"),
1279        ("vb", "vb"),
1280        ("vbs", "vb"),
1281        // TODO: could be vim (???)
1282        ("vba", "vb"),
1283        ("vdf", "vdf"),
1284        ("vdmpp", "vdmpp"),
1285        ("vpp", "vdmpp"),
1286        ("vdmrt", "vdmrt"),
1287        ("vdmsl", "vdmsl"),
1288        ("vdm", "vdmsl"),
1289        ("vto", "vento"),
1290        ("vr", "vera"),
1291        ("vri", "vera"),
1292        ("vrh", "vera"),
1293        ("va", "verilogams"),
1294        ("vams", "verilogams"),
1295        ("vhdl", "vhdl"),
1296        ("vst", "vhdl"),
1297        ("vhd", "vhdl"),
1298        ("hdl", "vhdl"),
1299        ("vho", "vhdl"),
1300        ("vbe", "vhdl"),
1301        ("tape", "vhs"),
1302        ("vim", "vim"),
1303        ("mar", "vmasm"),
1304        ("cm", "voscm"),
1305        ("wrl", "vrml"),
1306        ("vroom", "vroom"),
1307        ("vue", "vue"),
1308        ("wast", "wat"),
1309        ("wat", "wat"),
1310        ("wdl", "wdl"),
1311        ("wm", "webmacro"),
1312        ("wgsl", "wgsl"),
1313        ("wbt", "winbatch"),
1314        ("wit", "wit"),
1315        ("wml", "wml"),
1316        ("wsf", "wsh"),
1317        ("wsc", "wsh"),
1318        ("wsml", "wsml"),
1319        ("ad", "xdefaults"),
1320        ("xhtml", "xhtml"),
1321        ("xht", "xhtml"),
1322        ("msc", "xmath"),
1323        ("msf", "xmath"),
1324        ("psc1", "xml"),
1325        ("tpm", "xml"),
1326        ("xliff", "xml"),
1327        ("atom", "xml"),
1328        ("xul", "xml"),
1329        ("cdxml", "xml"),
1330        ("mpd", "xml"),
1331        ("rss", "xml"),
1332        ("fsproj", "xml"),
1333        ("ui", "xml"),
1334        ("vbproj", "xml"),
1335        ("xlf", "xml"),
1336        ("wsdl", "xml"),
1337        ("csproj", "xml"),
1338        ("wpl", "xml"),
1339        ("xmi", "xml"),
1340        ("xpr", "xml"),
1341        ("xpfm", "xml"),
1342        ("spfm", "xml"),
1343        ("bxml", "xml"),
1344        ("mmi", "xml"),
1345        ("xcu", "xml"),
1346        ("xlb", "xml"),
1347        ("xlc", "xml"),
1348        ("xba", "xml"),
1349        ("slnx", "xml"),
1350        // TODO: could be xpm2 or XPM2 (which are obviously not the same things)
1351        ("xpm", "xpm"),
1352        ("xpm2", "xpm2"),
1353        ("xqy", "xquery"),
1354        ("xqm", "xquery"),
1355        ("xquery", "xquery"),
1356        ("xq", "xquery"),
1357        ("xql", "xquery"),
1358        ("xs", "xs"),
1359        ("xsd", "xsd"),
1360        ("xsl", "xslt"),
1361        ("xslt", "xslt"),
1362        ("yy", "yacc"),
1363        ("y++", "yacc"),
1364        ("yxx", "yacc"),
1365        ("yml", "yaml"),
1366        ("yaml", "yaml"),
1367        ("eyaml", "yaml"),
1368        ("mplstyle", "yaml"),
1369        // TODO: could be xml
1370        ("grc", "yaml"),
1371        ("yang", "yang"),
1372        ("yuck", "yuck"),
1373        ("z8a", "z8a"),
1374        ("zig", "zig"),
1375        ("zon", "zig"),
1376        ("ziggy", "ziggy"),
1377        ("ziggy-schema", "ziggy_schema"),
1378        ("zu", "zimbu"),
1379        ("zut", "zimbutempl"),
1380        ("zs", "zserio"),
1381        ("zsh", "zsh"),
1382        ("zunit", "zsh"),
1383        ("zsh-theme", "zsh"),
1384        ("vala", "vala"),
1385        // TODO: could be winbatch
1386        ("web", "web"),
1387        // TODO: could be prolog
1388        ("pl", "perl"),
1389        // TODO: could be puppet
1390        ("pp", "pascal"),
1391        // TODO: could be swig 🍺
1392        ("i", "progress"),
1393        // TODO: could be cweb
1394        ("w", "progress"),
1395        // TODO: could be progress
1396        ("p", "pascal"),
1397        // TODO: could be other things
1398        ("pro", "prolog"),
1399        // TODO: could be patch
1400        ("patch", "diff"),
1401        // TODO: could be rexx
1402        ("r", "r"),
1403        // TODO: nil-ing i guess?
1404        ("rdf", "redif"),
1405        // TODO: AAAAAAAAAAAAAAAAAA
1406        ("rules", "javascript"),
1407        // TODO: could be superdupermegahypercolider
1408        ("sc", "scala"),
1409        // TODO: could be superdupermegahypercolider as well
1410        ("scd", "scdoc"),
1411        // TODO: idek
1412        ("tcsh", "tcsh"),
1413        // TODO: could be other sql flavors
1414        ("sql", "sql"),
1415        ("zsql", "sql"),
1416        // TODO: could be other tex flavors
1417        ("tex", "tex"),
1418        // TODO: could be terraform
1419        ("tf", "tf"),
1420        // TODO: which languages dare?
1421        ("txt", "text"),
1422        // TODO: could be other, secret xmls
1423        ("xml", "xml"),
1424        // TODO: racc is not yacc, bro
1425        ("y", "yacc"),
1426        // TODO: could be other irrelevant things
1427        ("cmd", "dosbatch"),
1428        // TODO: could be diva 💅
1429        ("rul", "ishd"),
1430        // TODO: could be cobol
1431        ("cpy", "python"),
1432        // TODO: could be structurizr
1433        ("dsl", "dsl"),
1434        // TODO: could be xml
1435        ("smil", "smil"),
1436        // TODO: could be mib 🕴
1437        ("smi", "smil"),
1438        // TODO: could be php
1439        ("install", "bash"),
1440        // TODO: could be the infamous xpm or its dastardly cousin, xpm2
1441        ("pm", "perl"),
1442        // TODO: could be nroff, again
1443        ("me", "objcpp"),
1444        // TODO: nil-ing i guess?
1445        ("reg", "registry"),
1446        // TODO: could be turtle 🐢
1447        ("ttl", "terraterm"),
1448        // TODO: could not be muttrc
1449        ("rc", "rc"),
1450        ("rch", "rc"),
1451        // TODO: nil-ing i guess?
1452        ("class", "scala"),
1453        // TODO: could be other things
1454        ("sgml", "sgml"),
1455        ("sgm", "sgml"),
1456        // TODO: could be nroff or tads
1457        ("t", "perl"),
1458        // No match means there is no clear language
1459        ("bak", ""),
1460        ("dpkg-bak", ""),
1461        ("dpkg-dist", ""),
1462        ("dpkg-old", ""),
1463        ("dpkg-new", ""),
1464        ("in", ""),
1465        ("new", ""),
1466        ("old", ""),
1467        ("orig", ""),
1468        ("pacsave", ""),
1469        ("pacnew", ""),
1470        ("rpmsave", ""),
1471        ("rmpnew", ""),
1472    ])
1473});
1474
1475static FILENAMES: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
1476    HashMap::from_iter([
1477        ("a2psrc", "a2ps"),
1478        ("/etc/a2ps.cfg", "a2ps"),
1479        (".a2psrc", "a2ps"),
1480        (".asoundrc", "alsaconf"),
1481        ("/usr/share/alsa/alsa.conf", "alsaconf"),
1482        ("/etc/asound.conf", "alsaconf"),
1483        ("build.xml", "ant"),
1484        (".htaccess", "apache"),
1485        ("APKBUILD", "apkbuild"),
1486        ("apt.conf", "aptconf"),
1487        ("/.aptitude/config", "aptconf"),
1488        ("=tagging-method", "arch"),
1489        (".arch-inventory", "arch"),
1490        ("makefile.am", "automake"),
1491        ("Makefile.am", "automake"),
1492        ("GNUmakefile.am", "automake"),
1493        (".bash_aliases", "bash"),
1494        (".bash-aliases", "bash"),
1495        (".bash_history", "bash"),
1496        (".bash-history", "bash"),
1497        (".bash_logout", "bash"),
1498        (".bash-logout", "bash"),
1499        (".bash_profile", "bash"),
1500        (".bash-profile", "bash"),
1501        ("named.root", "bindzone"),
1502        ("WORKSPACE", "bzl"),
1503        ("WORKSPACE.bzlmod", "bzl"),
1504        ("BUCK", "bzl"),
1505        ("BUILD", "bzl"),
1506        ("cabal.project", "cabalproject"),
1507        ("cabal.config", "cabalconfig"),
1508        ("calendar", "calendar"),
1509        ("catalog", "catalog"),
1510        ("/etc/cdrdao.conf", "cdrdaoconf"),
1511        (".cdrdao", "cdrdaoconf"),
1512        ("/etc/default/cdrdao", "cdrdaoconf"),
1513        ("/etc/defaults/cdrdao", "cdrdaoconf"),
1514        ("cfengine.conf", "cfengine"),
1515        ("cgdbrc", "cgdbrc"),
1516        ("init.trans", "clojure"),
1517        (".trans", "clojure"),
1518        ("CMakeLists.txt", "cmake"),
1519        ("CMakeCache.txt", "cmakecache"),
1520        (".cling_history", "cpp"),
1521        (".alias", "csh"),
1522        (".cshrc", "csh"),
1523        (".login", "csh"),
1524        ("csh.cshrc", "csh"),
1525        ("csh.login", "csh"),
1526        ("csh.logout", "csh"),
1527        ("auto.master", "conf"),
1528        ("texdoc.cnf", "conf"),
1529        (".x11vncrc", "conf"),
1530        (".chktexrc", "conf"),
1531        (".ripgreprc", "conf"),
1532        ("ripgreprc", "conf"),
1533        ("configure.in", "config"),
1534        ("configure.ac", "config"),
1535        ("crontab", "crontab"),
1536        (".cvsrc", "cvsrc"),
1537        ("/debian/changelog", "debchangelog"),
1538        ("changelog.dch", "debchangelog"),
1539        ("changelog.Debian", "debchangelog"),
1540        ("NEWS.dch", "debchangelog"),
1541        ("NEWS.Debian", "debchangelog"),
1542        ("/debian/control", "debcontrol"),
1543        ("/DEBIAN/control", "debcontrol"),
1544        ("/debian/copyright", "debcopyright"),
1545        ("/etc/apt/sources.list", "debsources"),
1546        ("denyhosts.conf", "denyhosts"),
1547        ("dict.conf", "dictconf"),
1548        (".dictrc", "dictconf"),
1549        ("/etc/DIR_COLORS", "dircolors"),
1550        (".dir_colors", "dircolors"),
1551        (".dircolors", "dircolors"),
1552        ("/etc/dnsmasq.conf", "dnsmasq"),
1553        ("Containerfile", "dockerfile"),
1554        ("dockerfile", "dockerfile"),
1555        ("Dockerfile", "dockerfile"),
1556        ("npmrc", "dosini"),
1557        ("/etc/yum.conf", "dosini"),
1558        (".npmrc", "dosini"),
1559        ("pip.conf", "dosini"),
1560        ("setup.cfg", "dosini"),
1561        ("pudb.cfg", "dosini"),
1562        (".coveragerc", "dosini"),
1563        (".pypirc", "dosini"),
1564        (".pylintrc", "dosini"),
1565        ("pylintrc", "dosini"),
1566        (".replyrc", "dosini"),
1567        (".gitlint", "dosini"),
1568        (".oelint.cfg", "dosini"),
1569        ("psprint.conf", "dosini"),
1570        ("sofficerc", "dosini"),
1571        ("mimeapps.list", "dosini"),
1572        (".wakatime.cfg", "dosini"),
1573        ("nfs.conf", "dosini"),
1574        ("nfsmount.conf", "dosini"),
1575        (".notmuch-config", "dosini"),
1576        (".alsoftrc", "dosini"),
1577        ("alsoft.conf", "dosini"),
1578        ("alsoft.ini", "dosini"),
1579        ("alsoftrc.sample", "dosini"),
1580        ("pacman.conf", "confini"),
1581        ("paru.conf", "confini"),
1582        ("mpv.conf", "confini"),
1583        ("dune", "dune"),
1584        ("jbuild", "dune"),
1585        ("dune-workspace", "dune"),
1586        ("dune-project", "dune"),
1587        ("dune-file", "dune"),
1588        ("Earthfile", "earthfile"),
1589        (".editorconfig", "editorconfig"),
1590        ("elinks.conf", "elinks"),
1591        ("mix.lock", "elixir"),
1592        ("filter-rules", "elmfilt"),
1593        ("exim.conf", "exim"),
1594        ("exports", "exports"),
1595        ("fennelrc", "fennel"),
1596        (".fennelrc", "fennel"),
1597        (".fetchmailrc", "fetchmail"),
1598        // TODO: nil-ing i guess?
1599        ("fvSchemes", "foam"),
1600        ("fvSolution", "foam"),
1601        ("fvConstraints", "foam"),
1602        ("fvModels", "foam"),
1603        ("fstab", "fstab"),
1604        ("mtab", "fstab"),
1605        (".gdbinit", "gdb"),
1606        ("gdbinit", "gdb"),
1607        (".gdbearlyinit", "gdb"),
1608        ("gdbearlyinit", "gdb"),
1609        ("lltxxxxx.txt", "gedcom"),
1610        ("TAG_EDITMSG", "gitcommit"),
1611        ("MERGE_MSG", "gitcommit"),
1612        ("COMMIT_EDITMSG", "gitcommit"),
1613        ("NOTES_EDITMSG", "gitcommit"),
1614        ("EDIT_DESCRIPTION", "gitcommit"),
1615        (".gitconfig", "gitconfig"),
1616        (".gitmodules", "gitconfig"),
1617        (".gitattributes", "gitattributes"),
1618        (".gitignore", "gitignore"),
1619        (".ignore", "gitignore"),
1620        (".containerignore", "gitignore"),
1621        (".dockerignore", "gitignore"),
1622        (".fdignore", "gitignore"),
1623        (".npmignore", "gitignore"),
1624        (".rgignore", "gitignore"),
1625        (".vscodeignore", "gitignore"),
1626        ("gitolite.conf", "gitolite"),
1627        ("git-rebase-todo", "gitrebase"),
1628        ("gkrellmrc", "gkrellmrc"),
1629        (".gnashrc", "gnash"),
1630        (".gnashpluginrc", "gnash"),
1631        ("gnashpluginrc", "gnash"),
1632        ("gnashrc", "gnash"),
1633        (".gnuplot_history", "gnuplot"),
1634        ("goaccess.conf", "goaccess"),
1635        ("go.sum", "gosum"),
1636        ("go.work.sum", "gosum"),
1637        ("go.work", "gowork"),
1638        (".gprc", "gp"),
1639        ("/.gnupg/gpg.conf", "gpg"),
1640        ("/.gnupg/options", "gpg"),
1641        ("Jenkinsfile", "groovy"),
1642        ("/var/backups/gshadow.bak", "group"),
1643        ("/etc/gshadow", "group"),
1644        ("/etc/group-", "group"),
1645        ("/etc/gshadow.edit", "group"),
1646        ("/etc/gshadow-", "group"),
1647        ("/etc/group", "group"),
1648        ("/var/backups/group.bak", "group"),
1649        ("/etc/group.edit", "group"),
1650        ("/boot/grub/menu.lst", "grub"),
1651        ("/etc/grub.conf", "grub"),
1652        ("/boot/grub/grub.conf", "grub"),
1653        (".gtkrc", "gtkrc"),
1654        ("gtkrc", "gtkrc"),
1655        ("snort.conf", "hog"),
1656        ("vision.conf", "hog"),
1657        ("/etc/host.conf", "hostconf"),
1658        ("/etc/hosts.allow", "hostsaccess"),
1659        ("/etc/hosts.deny", "hostsaccess"),
1660        (".hy-history", "hy"),
1661        ("hyprland.conf", "hyprlang"),
1662        ("hyprpaper.conf", "hyprlang"),
1663        ("hypridle.conf", "hyprlang"),
1664        ("hyprlock.conf", "hyprlang"),
1665        ("/.icewm/menu", "icemenu"),
1666        (".indent.pro", "indent"),
1667        ("indentrc", "indent"),
1668        ("inittab", "inittab"),
1669        ("ipf.conf", "ipfilter"),
1670        ("ipf6.conf", "ipfilter"),
1671        ("ipf.rules", "ipfilter"),
1672        (".bun_repl_history", "javascript"),
1673        (".node_repl_history", "javascript"),
1674        ("deno_history.txt", "javascript"),
1675        ("Pipfile.lock", "json"),
1676        (".firebaserc", "json"),
1677        (".prettierrc", "json"),
1678        (".stylelintrc", "json"),
1679        (".lintstagedrc", "json"),
1680        ("deno.lock", "json"),
1681        ("flake.lock", "json"),
1682        (".swcrc", "json"),
1683        (".babelrc", "jsonc"),
1684        (".eslintrc", "jsonc"),
1685        (".hintrc", "jsonc"),
1686        (".jscsrc", "jsonc"),
1687        (".jsfmtrc", "jsonc"),
1688        (".jshintrc", "jsonc"),
1689        (".luaurc", "jsonc"),
1690        (".swrc", "jsonc"),
1691        (".vsconfig", "jsonc"),
1692        ("bun.lock", "jsonc"),
1693        (".justfile", "just"),
1694        (".Justfile", "just"),
1695        (".JUSTFILE", "just"),
1696        ("justfile", "just"),
1697        ("Justfile", "just"),
1698        ("JUSTFILE", "just"),
1699        ("Kconfig", "kconfig"),
1700        ("Kconfig.debug", "kconfig"),
1701        ("Config.in", "kconfig"),
1702        ("ldaprc", "ldapconf"),
1703        (".ldaprc", "ldapconf"),
1704        ("ldap.conf", "ldapconf"),
1705        ("lfrc", "lf"),
1706        ("lftp.conf", "lftp"),
1707        (".lftprc", "lftp"),
1708        ("/.libao", "libao"),
1709        ("/etc/libao.conf", "libao"),
1710        ("lilo.conf", "lilo"),
1711        ("/etc/limits", "limits"),
1712        (".emacs", "lisp"),
1713        ("sbclrc", "lisp"),
1714        (".sbclrc", "lisp"),
1715        (".sawfishrc", "lisp"),
1716        ("/etc/login.access", "loginaccess"),
1717        ("/etc/login.defs", "logindefs"),
1718        (".lsl", "lsl"),
1719        (".busted", "lua"),
1720        (".luacheckrc", "lua"),
1721        (".lua_history", "lua"),
1722        ("config.ld", "lua"),
1723        ("rock_manifest", "lua"),
1724        ("lynx.cfg", "lynx"),
1725        ("m3overrides", "m3build"),
1726        ("m3makefile", "m3build"),
1727        ("cm3.cfg", "m3quake"),
1728        (".m4_history", "m4"),
1729        (".followup", "mail"),
1730        (".article", "mail"),
1731        (".letter", "mail"),
1732        ("/etc/aliases", "mailaliases"),
1733        ("/etc/mail/aliases", "mailaliases"),
1734        ("mailcap", "mailcap"),
1735        (".mailcap", "mailcap"),
1736        ("Kbuild", "make"),
1737        ("/etc/man.conf", "manconf"),
1738        ("man.config", "manconf"),
1739        ("maxima-init.mac", "maxima"),
1740        ("isyncrc", "mbsync"),
1741        ("meson.build", "meson"),
1742        ("meson.options", "meson"),
1743        ("meson_options.txt", "meson"),
1744        ("/etc/conf.modules", "modconf"),
1745        ("/etc/modules", "modconf"),
1746        ("/etc/modules.conf", "modconf"),
1747        ("/.mplayer/config", "mplayerconf"),
1748        ("mplayer.conf", "mplayerconf"),
1749        ("mrxvtrc", "mrxvtrc"),
1750        (".mrxvtrc", "mrxvtrc"),
1751        (".msmtprc", "msmtp"),
1752        ("Muttngrc", "muttrc"),
1753        ("Muttrc", "muttrc"),
1754        (".mysql_history", "mysql"),
1755        ("/etc/nanorc", "nanorc"),
1756        ("Neomuttrc", "neomuttrc"),
1757        (".netrc", "netrc"),
1758        // TODO: nil-ing i guess?
1759        ("NEWS", "debchangelog"),
1760        (".ocamlinit", "ocaml"),
1761        (".octaverc", "octave"),
1762        ("octaverc", "octave"),
1763        ("octave.conf", "octave"),
1764        (".ondirrc", "ondir"),
1765        ("opam", "opam"),
1766        ("opam.locked", "opam"),
1767        ("/etc/pam.conf", "pamconf"),
1768        ("pam_env.conf", "pamenv"),
1769        (".pam_environment", "pamenv"),
1770        ("/var/backups/passwd.bak", "passwd"),
1771        ("/var/backups/shadow.bak", "passwd"),
1772        ("/etc/passwd", "passwd"),
1773        ("/etc/passwd-", "passwd"),
1774        ("/etc/shadow.edit", "passwd"),
1775        ("/etc/shadow-", "passwd"),
1776        ("/etc/shadow", "passwd"),
1777        ("/etc/passwd.edit", "passwd"),
1778        (".gitolite.rc", "perl"),
1779        ("gitolite.rc", "perl"),
1780        ("example.gitolite.rc", "perl"),
1781        ("latexmkrc", "perl"),
1782        (".latexmkrc", "perl"),
1783        ("pf.conf", "pf"),
1784        ("main.cf", "pfmain"),
1785        ("main.cf.proto", "pfmain"),
1786        ("pinerc", "pine"),
1787        (".pinercex", "pine"),
1788        (".pinerc", "pine"),
1789        ("pinercex", "pine"),
1790        ("/etc/pinforc", "pinfo"),
1791        ("/.pinforc", "pinfo"),
1792        (".povrayrc", "povini"),
1793        // TODO: idek
1794        ("printcap", "ptcap"),
1795        ("termcap", "ptcap"),
1796        (".procmailrc", "procmail"),
1797        (".procmail", "procmail"),
1798        // TODO: could be other things
1799        ("indent.pro", "cpp"),
1800        ("/etc/protocols", "protocols"),
1801        // TODO: nil-ing i guess?
1802        ("INDEX", "psf"),
1803        ("INFO", "psf"),
1804        ("MANIFEST.in", "pymanifest"),
1805        (".pythonstartup", "python"),
1806        (".pythonrc", "python"),
1807        (".python_history", "python"),
1808        (".jline-jython.history", "python"),
1809        ("SConstruct", "python"),
1810        ("qmldir", "qmldir"),
1811        (".Rhistory", "r"),
1812        (".Rprofile", "r"),
1813        ("Rprofile", "r"),
1814        ("Rprofile.site", "r"),
1815        ("ratpoisonrc", "ratpoison"),
1816        (".ratpoisonrc", "ratpoison"),
1817        ("inputrc", "readline"),
1818        (".inputrc", "readline"),
1819        (".reminders", "remind"),
1820        ("requirements.txt", "requirements"),
1821        ("constraints.txt", "requirements"),
1822        ("requirements.in", "requirements"),
1823        ("resolv.conf", "resolv"),
1824        ("robots.txt", "robots"),
1825        ("Gemfile", "ruby"),
1826        ("Puppetfile", "ruby"),
1827        (".irbrc", "ruby"),
1828        ("irbrc", "ruby"),
1829        (".irb_history", "ruby"),
1830        ("irb_history", "ruby"),
1831        ("rakefile", "ruby"),
1832        ("Rakefile", "ruby"),
1833        ("rantfile", "ruby"),
1834        ("Rantfile", "ruby"),
1835        ("Vagrantfile", "ruby"),
1836        ("smb.conf", "samba"),
1837        (".lips_repl_history", "scheme"),
1838        (".guile", "scheme"),
1839        ("screenrc", "screen"),
1840        (".screenrc", "screen"),
1841        ("/etc/sensors3.conf", "sensors"),
1842        ("/etc/sensors.conf", "sensors"),
1843        ("/etc/services", "services"),
1844        ("/etc/serial.conf", "setserial"),
1845        ("/etc/udev/cdsymlinks.conf", "sh"),
1846        (".ash_history", "sh"),
1847        (".devscripts", "sh"),
1848        ("devscripts.conf", "sh"),
1849        ("makepkg.conf", "sh"),
1850        (".makepkg.conf", "sh"),
1851        ("user-dirs.dirs", "sh"),
1852        ("user-dirs.defaults", "sh"),
1853        (".xprofile", "sh"),
1854        ("bash.bashrc", "bash"),
1855        ("bashrc", "bash"),
1856        (".bashrc", "bash"),
1857        (".kshrc", "ksh"),
1858        (".profile", "bash"),
1859        ("/etc/profile", "bash"),
1860        ("PKGBUILD", "bash"),
1861        (".tcshrc", "tcsh"),
1862        ("tcsh.login", "tcsh"),
1863        ("tcsh.tcshrc", "tcsh"),
1864        ("/etc/slp.conf", "slpconf"),
1865        ("/etc/slp.reg", "slpreg"),
1866        ("/etc/slp.spi", "slpspi"),
1867        (".slrnrc", "slrnrc"),
1868        ("sendmail.cf", "sm"),
1869        ("Snakefile", "snakemake"),
1870        (".sqlite_history", "sql"),
1871        ("squid.conf", "squid"),
1872        ("ssh_config", "sshconfig"),
1873        ("sshd_config", "sshdconfig"),
1874        ("/etc/sudoers", "sudoers"),
1875        ("sudoers.tmp", "sudoers"),
1876        ("/etc/sysctl.conf", "sysctl"),
1877        ("tags", "tags"),
1878        ("pending.data", "taskdata"),
1879        ("completed.data", "taskdata"),
1880        ("undo.data", "taskdata"),
1881        (".tclshrc", "tcl"),
1882        (".wishrc", "tcl"),
1883        (".tclsh-history", "tcl"),
1884        ("tclsh.rc", "tcl"),
1885        (".xsctcmdhistory", "tcl"),
1886        (".xsdbcmdhistory", "tcl"),
1887        ("texmf.cnf", "texmf"),
1888        ("COPYING", "text"),
1889        // TODO: could be haredoc
1890        ("README", "text"),
1891        ("LICENSE", "text"),
1892        ("AUTHORS", "text"),
1893        ("tfrc", "tf"),
1894        (".tfrc", "tf"),
1895        ("tidy.conf", "tidy"),
1896        ("tidyrc", "tidy"),
1897        (".tidyrc", "tidy"),
1898        (".tmux.conf", "tmux"),
1899        ("Cargo.lock", "toml"),
1900        ("/.cargo/config", "toml"),
1901        ("/.cargo/credentials", "toml"),
1902        ("Pipfile", "toml"),
1903        ("Gopkg.lock", "toml"),
1904        ("uv.lock", "toml"),
1905        (".black", "toml"),
1906        // TODO: could be toml
1907        ("black", ""),
1908        ("trustees.conf", "trustees"),
1909        (".ts_node_repl_history", "typescript"),
1910        ("/etc/udev/udev.conf", "udevconf"),
1911        ("/etc/updatedb.conf", "updatedb"),
1912        ("fdrupstream.log", "upstreamlog"),
1913        ("vgrindefs", "vgrindefs"),
1914        (".exrc", "vim"),
1915        ("_exrc", "vim"),
1916        (".netrwhist", "vim"),
1917        ("_viminfo", "viminfo"),
1918        (".viminfo", "viminfo"),
1919        (".wgetrc", "wget"),
1920        (".wget2rc", "wget2"),
1921        ("wgetrc", "wget"),
1922        ("wget2rc", "wget2"),
1923        (".wvdialrc", "wvdial"),
1924        ("wvdial.conf", "wvdial"),
1925        (".XCompose", "xcompose"),
1926        ("Compose", "xcompose"),
1927        (".Xresources", "xdefaults"),
1928        (".Xpdefaults", "xdefaults"),
1929        ("xdm-config", "xdefaults"),
1930        (".Xdefaults", "xdefaults"),
1931        ("xorg.conf", "xf86conf"),
1932        ("xorg.conf-4", "xf86conf"),
1933        ("XF86Config", "xf86conf"),
1934        ("/etc/xinetd.conf", "xinetd"),
1935        ("fglrxrc", "xml"),
1936        ("/etc/blkid.tab", "xml"),
1937        ("/etc/blkid.tab.old", "xml"),
1938        ("fonts.conf", "xml"),
1939        ("Directory.Packages.props", "xml"),
1940        ("Directory.Build.props", "xml"),
1941        ("Directory.Build.targets", "xml"),
1942        (".clangd", "yaml"),
1943        (".clang-format", "yaml"),
1944        (".clang-tidy", "yaml"),
1945        ("pixi.lock", "yaml"),
1946        ("yarn.lock", "yaml"),
1947        ("matplotlibrc", "yaml"),
1948        (".condarc", "yaml"),
1949        ("condarc", "yaml"),
1950        ("zathurarc", "zathurarc"),
1951        ("/etc/zprofile", "zsh"),
1952        (".zlogin", "zsh"),
1953        (".zlogout", "zsh"),
1954        (".zshrc", "zsh"),
1955        (".zprofile", "zsh"),
1956        (".zcompdump", "zsh"),
1957        (".zsh_history", "zsh"),
1958        (".zshenv", "zsh"),
1959        (".zfbfmarks", "zsh"),
1960    ])
1961});
1962
1963static PATTERNS: LazyLock<(RegexSet, Vec<&str>)> = LazyLock::new(|| {
1964    let home = var("HOME");
1965    let xdg_config_home = var("XDG_CONFIG_HOME");
1966    let gnupghome = var("GNUPGHOME");
1967
1968    let maps = [
1969        ("/debian/changelog$", "debchangelog"),
1970        ("/debian/control$", "debcontrol"),
1971        ("/debian/copyright$", "debcopyright"),
1972        // TODO: nil-ing i guess?
1973        ("/debian/patches/", "dep3patch"),
1974        (r"/etc/a2ps\.cfg$", "a2ps"),
1975        (r"/etc/a2ps/.*\.cfg$", "a2ps"),
1976        ("/etc/aliases$", "mailaliases"),
1977        // TODO: whatever the hell starsetf is
1978        (r"/etc/apache2/conf\..*/", "apache"),
1979        (r"/etc/apache2/.*\.conf", "apache"),
1980        (r"/etc/apache2/mods\..*/", "apache"),
1981        (r"/etc/apache2/sites\..*/.*\.com$", "apache"),
1982        (r"/etc/apache2/sites\..*/", "apache"),
1983        (r"/etc/apt/sources\.list$", "debsources"),
1984        (r"/etc/apt/sources\.list\.d/.*\.list$", "debsources"),
1985        (r"/etc/apt/sources\.list\.d/.*\.sources$", "deb822sources"),
1986        (r"/etc/asound\.conf$", "alsaconf"),
1987        (r"/etc/blkid\.tab$", "xml"),
1988        (r"/etc/blkid\.tab\.old$", "xml"),
1989        (r"/etc/cdrdao\.conf$", "cdrdaoconf"),
1990        // TODO: nil-ing i guess?
1991        ("/etc/config/", "uci"),
1992        (r"/etc/conf\.modules$", "modconf"),
1993        // TODO: whatever the hell starsetf is
1994        (r"/etc/cron\.d/", "crontab"),
1995        ("/etc/default/cdrdao$", "cdrdaoconf"),
1996        ("/etc/defaults/cdrdao$", "cdrdaoconf"),
1997        ("/etc/DIR_COLORS$", "dircolors"),
1998        (r"/etc/dnsmasq\.conf$", "dnsmasq"),
1999        // TODO: whatever the hell starsetf is
2000        (r"/etc/dnsmasq\.d/", "dnsmasq"),
2001        ("/etc/gitattributes$", "gitattributes"),
2002        ("/etc/gitconfig$", "gitconfig"),
2003        // TODO: whatever the hell starsetf is
2004        (r"/etc/gitconfig\.d/", "gitconfig"),
2005        (r"/etc/group\.$", "group"),
2006        ("/etc/group$", "group"),
2007        (r"/etc/group\.edit$", "group"),
2008        (r"/etc/grub\.conf$", "grub"),
2009        (r"/etc/gshadow\.$", "group"),
2010        ("/etc/gshadow$", "group"),
2011        (r"/etc/gshadow\.edit$", "group"),
2012        (r"/etc/host\.conf$", "hostconf"),
2013        // TODO: whatever the hell starsetf is
2014        (r"/etc/hostname\.", "config"),
2015        (r"/etc/hosts\.allow$", "hostsaccess"),
2016        (r"/etc/hosts\.deny$", "hostsaccess"),
2017        (r"/etc/httpd/.*\.conf$", "apache"),
2018        (r"/etc/httpd/conf\.d/.*\.conf", "apache"),
2019        (r"/etc/httpd/conf\..*/", "apache"),
2020        (r"/etc/httpd/mods\..*/", "apache"),
2021        (r"/etc/httpd/sites\..*/", "apache"),
2022        (r"/etc/init/.*\.conf$", "upstart"),
2023        (r"/etc/initng/.*/.*\.i$", "initng"),
2024        (r"/etc/init/.*\.override$", "upstart"),
2025        (r"/etc/libao\.conf$", "libao"),
2026        ("/etc/limits$", "limits"),
2027        (r"/etc/.*limits\.conf$", "limits"),
2028        (r"/etc/.*limits\.d/.*\.conf$", "limits"),
2029        // TODO: whatever the hell starsetf is
2030        (r"/etc/logcheck/.*\.d.*/", "logcheck"),
2031        (r"/etc/login\.access$", "loginaccess"),
2032        (r"/etc/login\.defs$", "logindefs"),
2033        ("/etc/mail/aliases$", "mailaliases"),
2034        (r"/etc/man\.conf$", "manconf"),
2035        // TODO: whatever the hell starsetf is
2036        (r"/etc/modprobe\.", "modconf"),
2037        ("/etc/modules$", "modconf"),
2038        (r"/etc/modules\.conf$", "modconf"),
2039        // TODO: nil-ing i guess?
2040        ("/etc/modutils/", "modconf"),
2041        // TODO: whatever the hell starsetf is
2042        (r"/etc/Muttrc\.d/", "muttrc"),
2043        ("/etc/nanorc$", "nanorc"),
2044        ("/etc/nginx/", "nginx"),
2045        (r"/etc/pam\.conf$", "pamconf"),
2046        // TODO: whatever the hell starsetf is
2047        (r"/etc/pam\.d/", "pamconf"),
2048        (r"/etc/passwd\.$", "passwd"),
2049        ("/etc/passwd$", "passwd"),
2050        (r"/etc/passwd\.edit$", "passwd"),
2051        ("/etc/pinforc$", "pinfo"),
2052        ("/etc/profile$", "bash"),
2053        // TODO: whatever the hell starsetf is
2054        (r"/etc/proftpd/.*\.conf", "apachestyle"),
2055        (r"/etc/proftpd/conf\..*/", "apachestyle"),
2056        ("/etc/protocols$", "protocols"),
2057        (r"/etc/sensors3\.conf$", "sensors"),
2058        (r"/etc/sensors\.conf$", "sensors"),
2059        // TODO: whatever the hell starsetf is
2060        (r"/etc/sensors\.d/[^.]", "sensors"),
2061        (r"/etc/serial\.conf$", "setserial"),
2062        ("/etc/services$", "services"),
2063        (r"/etc/shadow\.$", "passwd"),
2064        ("/etc/shadow$", "passwd"),
2065        (r"/etc/shadow\.edit$", "passwd"),
2066        (r"/etc/slp\.conf$", "slpconf"),
2067        (r"/etc/slp\.reg$", "slpreg"),
2068        (r"/etc/slp\.spi$", "slpspi"),
2069        (r"/etc/ssh/ssh_config\.d/.*\.conf$", "sshconfig"),
2070        (r"/etc/ssh/sshd_config\.d/.*\.conf$", "sshdconfig"),
2071        ("/etc/sudoers$", "sudoers"),
2072        // TODO: whatever the hell starsetf is
2073        (r"/etc/sudoers\.d/", "sudoers"),
2074        (r"/etc/sysctl\.conf$", "sysctl"),
2075        (r"/etc/sysctl\.d/.*\.conf$", "sysctl"),
2076        (r"/etc/systemd/.*\.conf\.d/.*\.conf$", "systemd"),
2077        (r"/etc/systemd/system/.*\.d/.*\.conf$", "systemd"),
2078        (r"/etc/systemd/system/.*\.d/\.#", "systemd"),
2079        (r"/etc/systemd/system/\.#", "systemd"),
2080        (r"/etc/translate\.shell$", "clojure"),
2081        (r"/etc/udev/cdsymlinks\.conf$", "sh"),
2082        (r"/etc/udev/permissions\.d/.*\.permissions$", "udevperm"),
2083        (r"/etc/udev/udev\.conf$", "udevconf"),
2084        (r"/etc/updatedb\.conf$", "updatedb"),
2085        (r"/etc/xdg/menus/.*\.menu$", "xml"),
2086        (r"/etc/xinetd\.conf$", "xinetd"),
2087        // TODO: whatever the hell starsetf is
2088        (r"/etc/xinetd\.d/", "xinetd"),
2089        (r"/etc/yum\.conf$", "dosini"),
2090        // TODO: whatever the hell starsetf is
2091        (r"/etc/yum\.repos\.d/", "dosini"),
2092        ("/etc/zprofile$", "zsh"),
2093        (r"/log/auth\.crit$", "messages"),
2094        (r"/log/auth\.err$", "messages"),
2095        (r"/log/auth\.info$", "messages"),
2096        (r"/log/auth\.log$", "messages"),
2097        (r"/log/auth\.notice$", "messages"),
2098        (r"/log/auth\.warn$", "messages"),
2099        ("/log/auth$", "messages"),
2100        (r"/log/cron\.crit$", "messages"),
2101        (r"/log/cron\.err$", "messages"),
2102        (r"/log/cron\.info$", "messages"),
2103        (r"/log/cron\.log$", "messages"),
2104        (r"/log/cron\.notice$", "messages"),
2105        (r"/log/cron\.warn$", "messages"),
2106        ("/log/cron$", "messages"),
2107        (r"/log/daemon\.crit$", "messages"),
2108        (r"/log/daemon\.err$", "messages"),
2109        (r"/log/daemon\.info$", "messages"),
2110        (r"/log/daemon\.log$", "messages"),
2111        (r"/log/daemon\.notice$", "messages"),
2112        (r"/log/daemon\.warn$", "messages"),
2113        ("/log/daemon$", "messages"),
2114        (r"/log/debug\.crit$", "messages"),
2115        (r"/log/debug\.err$", "messages"),
2116        (r"/log/debug\.info$", "messages"),
2117        (r"/log/debug\.log$", "messages"),
2118        (r"/log/debug\.notice$", "messages"),
2119        (r"/log/debug\.warn$", "messages"),
2120        ("/log/debug$", "messages"),
2121        (r"/log/kern\.crit$", "messages"),
2122        (r"/log/kern\.err$", "messages"),
2123        (r"/log/kern\.info$", "messages"),
2124        (r"/log/kern\.log$", "messages"),
2125        (r"/log/kern\.notice$", "messages"),
2126        (r"/log/kern\.warn$", "messages"),
2127        ("/log/kern$", "messages"),
2128        (r"/log/lpr\.crit$", "messages"),
2129        (r"/log/lpr\.err$", "messages"),
2130        (r"/log/lpr\.info$", "messages"),
2131        (r"/log/lpr\.log$", "messages"),
2132        (r"/log/lpr\.notice$", "messages"),
2133        (r"/log/lpr\.warn$", "messages"),
2134        ("/log/lpr$", "messages"),
2135        (r"/log/mail\.crit$", "messages"),
2136        (r"/log/mail\.err$", "messages"),
2137        (r"/log/mail\.info$", "messages"),
2138        (r"/log/mail\.log$", "messages"),
2139        (r"/log/mail\.notice$", "messages"),
2140        (r"/log/mail\.warn$", "messages"),
2141        ("/log/mail$", "messages"),
2142        (r"/log/messages\.crit$", "messages"),
2143        (r"/log/messages\.err$", "messages"),
2144        (r"/log/messages\.info$", "messages"),
2145        (r"/log/messages\.log$", "messages"),
2146        (r"/log/messages\.notice$", "messages"),
2147        (r"/log/messages\.warn$", "messages"),
2148        ("/log/messages$", "messages"),
2149        (r"/log/news/news\.crit$", "messages"),
2150        (r"/log/news/news\.err$", "messages"),
2151        (r"/log/news/news\.info$", "messages"),
2152        (r"/log/news/news\.log$", "messages"),
2153        (r"/log/news/news\.notice$", "messages"),
2154        (r"/log/news/news\.warn$", "messages"),
2155        ("/log/news/news$", "messages"),
2156        (r"/log/syslog\.crit$", "messages"),
2157        (r"/log/syslog\.err$", "messages"),
2158        (r"/log/syslog\.info$", "messages"),
2159        (r"/log/syslog\.log$", "messages"),
2160        (r"/log/syslog\.notice$", "messages"),
2161        (r"/log/syslog\.warn$", "messages"),
2162        ("/log/syslog$", "messages"),
2163        (r"/log/user\.crit$", "messages"),
2164        (r"/log/user\.err$", "messages"),
2165        (r"/log/user\.info$", "messages"),
2166        (r"/log/user\.log$", "messages"),
2167        (r"/log/user\.notice$", "messages"),
2168        (r"/log/user\.warn$", "messages"),
2169        ("/log/user$", "messages"),
2170        (r"/\.config/systemd/user/\.#", "systemd"),
2171        (r"/\.config/systemd/user/.*\.d/\.#", "systemd"),
2172        (r"/\.config/systemd/user/.*\.d/.*\.conf$", "systemd"),
2173        (r"/systemd/.*\.automount$", "systemd"),
2174        (r"/systemd/.*\.dnssd$", "systemd"),
2175        (r"/systemd/.*\.link$", "systemd"),
2176        (r"/systemd/.*\.mount$", "systemd"),
2177        (r"/systemd/.*\.netdev$", "systemd"),
2178        (r"/systemd/.*\.network$", "systemd"),
2179        (r"/systemd/.*\.nspawn$", "systemd"),
2180        (r"/systemd/.*\.path$", "systemd"),
2181        (r"/systemd/.*\.service$", "systemd"),
2182        (r"/systemd/.*\.slice$", "systemd"),
2183        (r"/systemd/.*\.socket$", "systemd"),
2184        (r"/systemd/.*\.swap$", "systemd"),
2185        (r"/systemd/.*\.target$", "systemd"),
2186        (r"/systemd/.*\.timer$", "systemd"),
2187        (r"/usr/share/alsa/alsa\.conf$", "alsaconf"),
2188        (r"/usr/.*/gnupg/options\.skel$", "gpg"),
2189        (r"/usr/share/upstart/.*\.conf$", "upstart"),
2190        (r"/usr/share/upstart/.*\.override$", "upstart"),
2191        (r"/var/backups/group\.bak$", "group"),
2192        (r"/var/backups/gshadow\.bak$", "group"),
2193        (r"/var/backups/passwd\.bak$", "passwd"),
2194        (r"/var/backups/shadow\.bak$", "passwd"),
2195        (r"/\.aptitude/config$", "aptconf"),
2196        (r"/build/conf/.*\.conf$", "bitbake"),
2197        (r"/meta\..*/conf/.*\.conf$", "bitbake"),
2198        (r"/meta/conf/.*\.conf$", "bitbake"),
2199        (r"/project\.spec/configs/.*\.conf$", "bitbake"),
2200        (r"/\.cabal/config$", "cabalconfig"),
2201        ("/cabal/config$", "cabalconfig"),
2202        (r"/\.aws/config$", "confini"),
2203        ("/bpython/config$", "dosini"),
2204        ("/flatpak/repo/config$", "dosini"),
2205        ("/mypy/config$", "dosini"),
2206        (fmt!(r"^{home}/\.config/notmuch/.*/config$"), "dosini"),
2207        (fmt!("^{xdg_config_home}/notmuch/.*/config$"), "dosini"),
2208        (fmt!("^{xdg_config_home}/git/config$"), "gitconfig"),
2209        (r"\.git/config\.worktree$", "gitconfig"),
2210        (r"\.git/config$", "gitconfig"),
2211        (r"\.git/modules/.*/config$", "gitconfig"),
2212        (r"\.git/modules/config$", "gitconfig"),
2213        (r"\.git/worktrees/.*/config\.worktree$", "gitconfig"),
2214        (r"/\.config/git/config$", "gitconfig"),
2215        // TODO: whatever the hell starsetf is
2216        (r"/gitolite\.admin/conf/", "gitolite"),
2217        (r"/\.i3/config$", "i3config"),
2218        ("/i3/config$", "i3config"),
2219        (r"/\.mplayer/config$", "mplayerconf"),
2220        ("/supertux2/config$", "scheme"),
2221        (r"/neofetch/config\.conf$", "sh"),
2222        (r"/\.ssh/config$", "sshconfig"),
2223        (r"/\.sway/config$", "swayconfig"),
2224        ("/sway/config$", "swayconfig"),
2225        (r"/\.cargo/config$", "toml"),
2226        (r"/\.bundle/config$", "yaml"),
2227        (r"/\.kube/config$", "yaml"),
2228        (r"/\.aws/credentials$", "confini"),
2229        // TODO: whatever the hell starsetf is
2230        (r"/\.gitconfig\.d/", "gitconfig"),
2231        (r"/\.gnupg/gpg\.conf$", "gpg"),
2232        (r"/\.gnupg/options$", "gpg"),
2233        (r"/\.icewm/menu$", "icemenu"),
2234        (r"/\.libao$", "libao"),
2235        (r"/\.pinforc$", "pinfo"),
2236        (r"/\.cargo/credentials$", "toml"),
2237        (r"/\.init/.*\.override$", "upstart"),
2238        // TODO: whatever the hell starsetf is
2239        (r"/\.calendar/", "calendar"),
2240        (r"/share/calendar/.*/calendar\.", "calendar"),
2241        (r"/share/calendar/calendar\.", "calendar"),
2242        (r"/\.?cmus/.*\.theme$", "cmusrc"),
2243        (r"/\.?cmus/rc$", "cmusrc"),
2244        (r"/\.cmus/autosave$", "cmusrc"),
2245        (r"/\.cmus/command\.history$", "cmusrc"),
2246        // TODO: nil-ing i guess?
2247        (r"\.git/", "git"),
2248        (fmt!("^{xdg_config_home}/git/attributes$"), "gitattributes"),
2249        (r"\.git/info/attributes$", "gitattributes"),
2250        (r"/\.config/git/attributes$", "gitattributes"),
2251        (fmt!("^{xdg_config_home}/git/ignore$"), "gitignore"),
2252        (r"\.git/info/exclude$", "gitignore"),
2253        (r"/\.config/git/ignore$", "gitignore"),
2254        (r"enlightenment/.*\.cfg$", "c"),
2255        (r"Eterm/.*\.cfg$", "eterm"),
2256        (r"baseq[2-3/.*\.cfg$]", "quake"),
2257        (r"id1/.*\.cfg$", "quake"),
2258        (r"quake[1-3/.*\.cfg$]", "quake"),
2259        (r"/tex/latex/.*\.cfg$", "tex"),
2260        // TODO: whatever the hell starsetf is
2261        (r"^proftpd\.conf", "apachestyle"),
2262        (r"^access\.conf", "apache"),
2263        (r"^apache\.conf", "apache"),
2264        (r"^apache2\.conf", "apache"),
2265        (r"^httpd\.conf", "apache"),
2266        (r"^httpd\..*\.conf", "apache"),
2267        (r"^proxy\.html\.conf", "apache"),
2268        (r"^srm\.conf", "apache"),
2269        // TODO: whatever the hell starsetf is
2270        (r"asterisk/.*\.conf", "asterisk"),
2271        // TODO: whatever the hell starsetf is
2272        (r"asterisk.*/.*voicemail\.conf", "asteriskvm"),
2273        (r"^dictd.*\.conf$", "dictdconf"),
2274        (r"/\.?gnuradio/.*\.conf$", "confini"),
2275        (r"/gnuradio/conf\.d/.*\.conf$", "confini"),
2276        (r"/lxqt/.*\.conf$", "dosini"),
2277        (r"/screengrab/.*\.conf$", "dosini"),
2278        (r"/\.config/fd/ignore$", "gitignore"),
2279        (fmt!(r"^{gnupghome}/gpg\.conf$"), "gpg"),
2280        (r"/boot/grub/grub\.conf$", "grub"),
2281        (r"/hypr/.*\.conf$", "hyprlang"),
2282        // TODO: whatever the hell starsetf is
2283        (r"^lilo\.conf", "lilo"),
2284        (r"^named.*\.conf$", "named"),
2285        (r"^rndc.*\.conf$", "named"),
2286        (r"/openvpn/.*/.*\.conf$", "openvpn"),
2287        (r"/pipewire/.*\.conf$", "spajson"),
2288        (r"/wireplumber/.*\.conf$", "spajson"),
2289        (r"/\.ssh/.*\.conf$", "sshconfig"),
2290        (r"^\.?tmux.*\.conf$", "tmux"),
2291        (r"^\.?tmux.*\.conf", "tmux"),
2292        (r"/containers/containers\.conf$", "toml"),
2293        (r"/containers/containers\.conf\.d/.*\.conf$", "toml"),
2294        (r"/containers/containers\.conf\.modules/.*\.conf$", "toml"),
2295        (r"/containers/registries\.conf$", "toml"),
2296        (r"/containers/registries\.conf\.d/.*\.conf$", "toml"),
2297        (r"/containers/storage\.conf$", "toml"),
2298        (r"/\.config/upstart/.*\.conf$", "upstart"),
2299        (r"/\.config/upstart/.*\.override$", "upstart"),
2300        (r"/\.init/.*\.conf$", "upstart"),
2301        (r"/xorg\.conf\.d/.*\.conf$", "xf86conf"),
2302        (r"\.\.sst\.meta$", "sisu"),
2303        (r"\._sst\.meta$", "sisu"),
2304        (r"\.sst\.meta$", "sisu"),
2305        // TODO: Whatever the hell starsetf is
2306        (r"^Containerfile\.", "dockerfile"),
2307        (r"^Dockerfile\.", "dockerfile"),
2308        ("[mM]akefile$", "make"),
2309        // TODO: Whatever the hell starsetf is
2310        ("^[mM]akefile", "make"),
2311        // TODO: Whatever the hell starsetf is
2312        ("^[rR]akefile", "ruby"),
2313        (r"^\.profile", "bash"),
2314        // TODO: Whatever the hell starsetf is
2315        (r"/\.fvwm/", "fvwm"),
2316        ("fvwmrc", "fvwm"),
2317        (r"fvwm95.*\.hook$", "fvwm"),
2318        // TODO: Could be fvwm2m4
2319        ("fvwm2rc", "fvwm"),
2320        (r"/nginx/.*\.conf$", "nginx"),
2321        ("/usr/local/nginx/conf/", "nginx"),
2322        (r"nginx\.conf$", "nginx"),
2323        (r"^nginx.*\.conf$", "nginx"),
2324        (r"\.requirements\.txt$", "requirements"),
2325        (r"^requirements/.*\.txt$", "requirements"),
2326        (r"^requires/.*\.txt$", "requirements"),
2327        ("s6.*/down$", "execline"),
2328        ("s6.*/finish$", "execline"),
2329        ("s6.*/run$", "execline"),
2330        ("s6.*/up$", "execline"),
2331        (r"^s6\.", "execline"),
2332        (r"^mutt\..*\.\.+$", "mail"),
2333        (r"^mutt[\._-]{6}$", "mail"),
2334        (r"^muttng\..*\.\.+$", "mail"),
2335        (r"^neomutt\..*\.\.+$", "mail"),
2336        (r"^neomutt[\._-]$", "mail"),
2337        // TODO: Whatever the hell starsetf is
2338        (r"^\.?muttngrc", "muttrc"),
2339        (r"^\.?muttrc", "muttrc"),
2340        (r"/\.mutt/muttrc", "muttrc"),
2341        (r"/\.muttng/muttngrc", "muttrc"),
2342        (r"/\.muttng/muttrc", "muttrc"),
2343        ("^Muttngrc", "muttrc"),
2344        ("^Muttrc", "muttrc"),
2345        // TODO: Whatever the hell starsetf is
2346        (r"^\.?neomuttrc", "neomuttrc"),
2347        (r"/\.neomutt/neomuttrc", "neomuttrc"),
2348        ("^Neomuttrc", "neomuttrc"),
2349        (r"\.neomuttdebug", "neomuttlog"),
2350        // TODO: Whatever the hell starsetf is
2351        (r"/\.?xkb/compat/", "xkb"),
2352        (r"/\.?xkb/geometry/", "xkb"),
2353        (r"/\.?xkb/keycodes/", "xkb"),
2354        (r"/\.?xkb/symbols/", "xkb"),
2355        (r"/\.?xkb/types/", "xkb"),
2356        (r"/m17n/.*\.ali$", "m17ndb"),
2357        (r"/m17n/.*\.cs$", "m17ndb"),
2358        (r"/m17n/.*\.dir$", "m17ndb"),
2359        (r"/m17n/.*\.flt$", "m17ndb"),
2360        (r"/m17n/.*\.fst$", "m17ndb"),
2361        (r"/m17n/.*\.lnm$", "m17ndb"),
2362        (r"/m17n/.*\.mic$", "m17ndb"),
2363        (r"/m17n/.*\.mim$", "m17ndb"),
2364        (r"/m17n/.*\.tbl$", "m17ndb"),
2365        (r"/\.m17n\.d/.*\.ali$", "m17ndb"),
2366        (r"/\.m17n\.d/.*\.cs$", "m17ndb"),
2367        (r"/\.m17n\.d/.*\.dir$", "m17ndb"),
2368        (r"/\.m17n\.d/.*\.flt$", "m17ndb"),
2369        (r"/\.m17n\.d/.*\.fst$", "m17ndb"),
2370        (r"/\.m17n\.d/.*\.lnm$", "m17ndb"),
2371        (r"/\.m17n\.d/.*\.mic$", "m17ndb"),
2372        (r"/\.m17n\.d/.*\.mim$", "m17ndb"),
2373        (r"/\.m17n\.d/.*\.tbl$", "m17ndb"),
2374        (r"/m17n\.db/.*\.ali$", "m17ndb"),
2375        (r"/m17n\.db/.*\.cs$", "m17ndb"),
2376        (r"/m17n\.db/.*\.dir$", "m17ndb"),
2377        (r"/m17n\.db/.*\.flt$", "m17ndb"),
2378        (r"/m17n\.db/.*\.fst$", "m17ndb"),
2379        (r"/m17n\.db/.*\.lnm$", "m17ndb"),
2380        (r"/m17n\.db/.*\.mic$", "m17ndb"),
2381        (r"/m17n\.db/.*\.mim$", "m17ndb"),
2382        (r"/m17n\.db/.*\.tbl$", "m17ndb"),
2383        (r"^\.cshrc", "csh"),
2384        (r"^\.login", "csh"),
2385        (r"^\.notmuch\.config\.", "dosini"),
2386        (r"^\.gitsendemail\.msg\.......$", "gitsendemail"),
2387        (r"^\.kshrc", "ksh"),
2388        (r"^\.article\.\.+$", "mail"),
2389        (r"^\.letter\.\.+$", "mail"),
2390        (r"^\.reminders", "remind"),
2391        (r"^\.tcshrc", "tcsh"),
2392        (r"^\.zcompdump", "zsh"),
2393        (r"\.csproj\.user$", "xml"),
2394        (r"\.fsproj\.user$", "xml"),
2395        (r"\.vbproj\.user$", "xml"),
2396        (r"^bash\.fc[\-\.]", "bash"),
2397        (r"/bind/db\.", "bindzone"),
2398        (r"/named/db\.", "bindzone"),
2399        (r"\.blade\.php$", "blade"),
2400        (r"^bzr_log\.", "bzr"),
2401        // TODO: Whatever the hell starsetf is
2402        (r"^cabal\.project\.", "cabalproject"),
2403        (r"^sgml\.catalog", "catalog"),
2404        ("hgrc$", "cfg"),
2405        // TODO: Could be debchangelog
2406        ("^[cC]hange[lL]og", "changelog"),
2407        (r"\.\.ch$", "chill"),
2408        (r"\.cmake\.in$", "cmake"),
2409        // TODO: Whatever the hell starsetf is
2410        (r"^crontab\.", "crontab"),
2411        (r"^cvs\.+$", "cvs"),
2412        ("/DEBIAN/control$", "debcontrol"),
2413        (r"^php\.ini\.", "dosini"),
2414        (r"^php\.fpm\.conf", "dosini"),
2415        (r"^www\.conf", "dosini"),
2416        // TODO: Whatever the hell starsetf is
2417        (r"^drac\.", "dracula"),
2418        (r"/dtrace/.*\.d$", "dtrace"),
2419        ("esmtprc$", "esmtprc"),
2420        (r"/0\.orig/", "foam"),
2421        ("/0/", "foam"),
2422        ("/constant/g$", "foam"),
2423        (r"Transport\.", "foam"),
2424        (r"^[a-zA-Z0-9].*Dict\.", "foam"),
2425        ("^[a-zA-Z0-9].*Dict$", "foam"),
2426        (r"^[a-zA-Z].*Properties\.", "foam"),
2427        ("^[a-zA-Z].*Properties$", "foam"),
2428        // TODO: Whatever the hell starsetf is
2429        ("/tmp/lltmp", "gedcom"),
2430        ("^gkrellmrc_.$", "gkrellmrc"),
2431        (fmt!("^{gnupghome}/options$"), "gpg"),
2432        (r"/boot/grub/menu\.lst$", "grub"),
2433        // TODO: Whatever the hell starsetf is
2434        (r"^\.?gtkrc", "gtkrc"),
2435        // (r"/doc/.*\.txt$", function(_, bufnr))
2436        //   local line, M._getline(bufnr, -1)
2437        //   if
2438        //     M._findany(line, {
2439        //       (r"^vim:ft=help[:\.]"),
2440        //       ("^vim:ft=help$"),
2441        //       (r"^vim:filetype=help[:\.]"),
2442        //       ("^vim:filetype=help$"),
2443        //       (r"^vim:.*[:\.]ft=help[:\.]"),
2444        //       (r"^vim:.*[:\.]ft=help$"),
2445        //       (r"^vim:.*[:\.]filetype=help[:\.]"),
2446        //       (r"^vim:.*[:\.]filetype=help$"),
2447        //       (r"\.vim:ft=help[:\.]"),
2448        //       (r"\.vim:ft=help$"),
2449        //       (r"\.vim:filetype=help[:\.]"),
2450        //       (r"\.vim:filetype=help$"),
2451        //       (r"\.vim:.*[:\.]ft=help[:\.]"),
2452        //       (r"\.vim:.*[:\.]ft=help$"),
2453        //       (r"\.vim:.*[:\.]filetype=help[:\.]"),
2454        //       (r"\.vim:.*[:\.]filetype=help$"),
2455        //     })
2456        //   then
2457        //     return "help"
2458        //   end
2459        // end,
2460        (r"^hg\.editor\..*\.txt$", "hgcommit"),
2461        (r"\.html\.m4$", "htmlm4"),
2462        // TODO: Whatever the hell starsetf is
2463        (r"^JAM.*\.", "jam"),
2464        (r"^Prl.*\.", "jam"),
2465        (fmt!(r"^{home}/.*/Code/User/.*\.json$"), "jsonc"),
2466        (fmt!(r"^{home}/.*/VSCodium/User/.*\.json$"), "jsonc"),
2467        (r"\.properties_..$", "jproperties"),
2468        (r"\.properties_.._..$", "jproperties"),
2469        // TODO: Whatever the hell starsetf is
2470        (r"\.properties_.._.._", "jproperties"),
2471        (r"^org\.eclipse\..*\.prefs$", "jproperties"),
2472        (r"^[jt]sconfig.*\.json$", "jsonc"),
2473        // TODO: Whatever the hell starsetf is
2474        (r"^Config\.in\.", "kconfig"),
2475        (r"^Kconfig\.", "kconfig"),
2476        ("/ldscripts/", "ld"),
2477        ("lftp/rc$", "lftp"),
2478        (r"/LiteStep/.*/.*\.rc$", "litestep"),
2479        (r"^/tmp/SLRN[0-9A-Z\.]+$", "mail"),
2480        (r"^ae\.+\.txt$", "mail"),
2481        (r"^pico\.\.+$", "mail"),
2482        // TODO: Whatever the hell starsetf is
2483        (r"^reportbug\.", "mail"),
2484        (r"^snd\.\.+$", "mail"),
2485        (r"^rndc.*\.key$", "named"),
2486        // TODO: Whatever the hell starsetf is
2487        (r"^tmac\.", "nroff"),
2488        (r"\.ml\.cppo$", "ocaml"),
2489        (r"\.mli\.cppo$", "ocaml"),
2490        ("/octave/history$", "octave"),
2491        (r"\.opam\.locked$", "opam"),
2492        (r"\.opam\.template$", "opam"),
2493        (r"^pacman\.log", "pacmanlog"),
2494        // ("printcap", starsetf(function(path, bufnr))
2495        //   return require("vim.filetype.detect").printcap("print")
2496        // end),
2497        (r"/queries/.*\.scm$", "query"),
2498        (",v$", "rcs"),
2499        (r"^svn\.commit.*\.tmp$", "svn"),
2500        (r"\.swift\.gyb$", "swiftgyb"),
2501        // ("termcap", starsetf(function(path, bufnr))
2502        //   return require("vim.filetype.detect").printcap("term")
2503        // end),
2504        (r"\.t\.html$", "tilde"),
2505        // TODO: Whatever the hell starsetf is
2506        (r"\.vhdl_[0-9]", "vhdl"),
2507        // TODO: Whatever the hell starsetf is
2508        ("vimrc", "vim"),
2509        // TODO: Whatever the hell starsetf is
2510        ("/Xresources/", "xdefaults"),
2511        (r"/app\.defaults/", "xdefaults"),
2512        ("^Xresources", "xdefaults"),
2513        (r"^XF86Config\.4", "xf86conf"),
2514        ("^XF86Config", "xf86conf"),
2515        ("Xmodmap$", "xmodmap"),
2516        // TODO: Whatever the hell starsetf is
2517        ("xmodmap", "xmodmap"),
2518        // TODO: Whatever the hell starsetf is
2519        (r"^\.?zlog", "zsh"),
2520        (r"^\.?zsh", "zsh"),
2521        // ("~$", function(path, bufnr))
2522        //   local short, path:gsub("~+$", "", 1)
2523        //   if path ~= short and short ~= "" then
2524        //     return M.match({ buf, bufnr, filename, fn.fnameescape(short) })
2525        //   end
2526        // end,
2527    ];
2528
2529    (
2530        RegexSet::new(maps.iter().map(|(pat, _)| *pat)).unwrap(),
2531        Vec::from_iter(maps.iter().map(|(_, lang)| *lang)),
2532    )
2533});
2534
2535fn var(str: &str) -> String {
2536    std::env::var(str).unwrap_or_default()
2537}