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