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