vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

ft.vim (82556B)


      1 vim9script
      2 
      3 # Vim functions for file type detection
      4 #
      5 # Maintainer:		The Vim Project <https://github.com/vim/vim>
      6 # Last Change:		2026 Sep 24
      7 # Former Maintainer:	Bram Moolenaar <Bram@vim.org>
      8 
      9 # These functions are moved here from runtime/filetype.vim to make startup
     10 # faster.
     11 
     12 var prolog_pattern = '^\s*\(:-\|%\+\(\s\|$\)\|\/\*\)\|\.\s*$'
     13 
     14 def IsObjectScriptRoutine(): bool
     15   var line1 = getline(1)
     16   line1 = substitute(line1, '^\ufeff', '', '')
     17   if line1 =~? '^\s*routine\>'
     18     return true
     19   endif
     20   if line1 =~? '\<iris\>'
     21     return true
     22   endif
     23   return join(getline(1, 3), '') =~# '%RO'
     24 enddef
     25 
     26 export def Check_inp()
     27   if getline(1) =~ '%%'
     28     setf tex
     29   elseif getline(1) =~ '^\*'
     30     setf abaqus
     31   else
     32     var n = 1
     33     var nmax = line("$") > 500 ? 500 : line("$")
     34     while n <= nmax
     35       if getline(n) =~? "^header surface data"
     36 	setf trasys
     37 	break
     38       endif
     39       n += 1
     40     endwhile
     41   endif
     42 enddef
     43 
     44 # AL (Microsoft Dynamics 365 Business Central) or Perl AutoLoader
     45 export def FTal()
     46   if exists("g:filetype_al")
     47     exe "setf " .. g:filetype_al
     48     return
     49   endif
     50 
     51   # AL sources declare an object as "<kind> <id> <name>" at the start of a
     52   # line, optionally preceded by namespace and using declarations.  Perl
     53   # AutoLoader chunks match neither.  Matching a bare keyword anywhere would
     54   # be wrong: table, page and report are ordinary English words, so the object
     55   # name must follow.  The match is case sensitive because AL tooling emits
     56   # lowercase keywords, while prose in Perl comments is usually capitalised.
     57   for lnum in range(1, min([line("$"), 200]))
     58     var line = getline(lnum)
     59     if line =~# '^\s*\%(codeunit\|page\|pageextension\|pagecustomization\|table\|tableextension\|' ..
     60       'report\|reportextension\|xmlport\|query\|enum\|enumextension\|profile\|profileextension\|' ..
     61       'controladdin\|interface\|permissionset\|permissionsetextension\|entitlement\)\>\s\+\%(\d\|"\|\u\)'
     62       || line =~# '^\s*dotnet\s*$'
     63       || line =~# '^\s*\%(namespace\|using\)\s\+[[:alnum:]._]\+\s*;'
     64       setf al
     65       return
     66     endif
     67   endfor
     68 
     69   setf perl
     70 enddef
     71 
     72 # Erlang Application Resource Files (*.app.src is matched by extension)
     73 # See: https://erlang.org/doc/system/applications
     74 export def FTapp()
     75   if exists("g:filetype_app")
     76     exe "setf " .. g:filetype_app
     77     return
     78   endif
     79   const pat = '^\s*{\s*application\s*,\s*\(''\=\)' .. expand("%:t:r:r") .. '\1\s*,'
     80   var line: string
     81   for lnum in range(1, min([line("$"), 100]))
     82     line = getline(lnum)
     83     # skip Erlang comments, might be something else
     84     if line =~ '^\s*%' || line =~ '^\s*$'
     85       continue
     86     elseif line =~ '^\s*{' &&
     87 	getline(lnum, lnum + 9)->filter((_, v) => v !~ '^\s*%')->join(' ') =~# pat
     88       setf erlang
     89     endif
     90     return
     91   endfor
     92 enddef
     93 
     94 # This function checks for Kawasaki robots AS file or atlas file type.
     95 export def FTas()
     96   if exists("g:filetype_as")
     97     exe "setf " .. g:filetype_as
     98     return
     99   endif
    100   for lnum in range(1, min([line("$"), 30]))
    101     if getline(lnum) =~ '^\.NETCONF'
    102       setf kawasaki_as
    103       return
    104     endif
    105   endfor
    106   setf atlas
    107 enddef
    108 
    109 # This function checks for the kind of assembly that is wanted by the user, or
    110 # can be detected from the beginning of the file.
    111 export def FTasm()
    112   # make sure b:asmsyntax exists
    113   if !exists("b:asmsyntax")
    114     b:asmsyntax = ""
    115   endif
    116 
    117   if b:asmsyntax == ""
    118     FTasmsyntax()
    119   endif
    120 
    121   # if b:asmsyntax still isn't set, default to asmsyntax or GNU
    122   if b:asmsyntax == ""
    123     if exists("g:asmsyntax")
    124       b:asmsyntax = g:asmsyntax
    125     else
    126       b:asmsyntax = "asm"
    127     endif
    128   endif
    129 
    130   exe "setf " .. fnameescape(b:asmsyntax)
    131 enddef
    132 
    133 export def FTmac()
    134   if exists("g:filetype_mac")
    135     exe "setf " .. g:filetype_mac
    136   else
    137     if IsObjectScriptRoutine()
    138       setf objectscript_routine
    139     else
    140       FTasm()
    141     endif
    142   endif
    143 enddef
    144 
    145 export def FTasmsyntax()
    146   # see if the file contains any asmsyntax=foo overrides. If so, change
    147   # b:asmsyntax appropriately
    148   var head = " " .. getline(1) .. " " .. getline(2) .. " "
    149 	.. getline(3) .. " " .. getline(4) ..  " " .. getline(5) .. " "
    150   var match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s')
    151   if match != ''
    152     b:asmsyntax = match
    153     return
    154   endif
    155   # Use heuristics
    156   var is_slash_star_encountered = false
    157   var i = 1
    158   const n = min([50, line("$")])
    159   while i <= n
    160     const line = getline(i)
    161     if line =~ '^/\*'
    162       is_slash_star_encountered = true
    163     endif
    164     if line =~# '^; Listing generated by Microsoft' || line =~? '^\%(\%(CONST\|_BSS\|_DATA\|_TEXT\)\s\+SEGMENT\>\)\|\s*\.[2-6]86P\?\>\|\s*\.XMM\>'
    165       b:asmsyntax = "masm"
    166       return
    167     elseif line =~ 'Texas Instruments Incorporated' || (line =~ '^\*' && !is_slash_star_encountered)
    168       # tiasm uses `* comment`, but detection is unreliable if '/*' is seen
    169       b:asmsyntax = "tiasm"
    170       return
    171     elseif ((line =~? '\.title\>\|\.ident\>\|\.macro\>\|\.subtitle\>\|\.library\>'))
    172       b:asmsyntax = "vmasm"
    173       return
    174     endif
    175     i += 1
    176   endwhile
    177 enddef
    178 
    179 var ft_visual_basic_content = '\c^\s*\%(Attribute\s\+VB_Name\|Begin\s\+\%(VB\.\|{\%(\x\+-\)\+\x\+}\)\)'
    180 
    181 # See FTfrm() for Visual Basic form file detection
    182 export def FTbas()
    183   if exists("g:filetype_bas")
    184     exe "setf " .. g:filetype_bas
    185     return
    186   endif
    187 
    188   # most frequent FreeBASIC-specific keywords in distro files
    189   var fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!'
    190   var fb_preproc  = '\c^\s*\%(' ..
    191                       # preprocessor
    192                       '#\s*\a\+\|' ..
    193                       # compiler option
    194                       'option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|' ..
    195                       # metacommand
    196                       '\%(''\|rem\)\s*\$lang\>\|' ..
    197                       # default datatype
    198                       'def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>' ..
    199                     '\)'
    200   var fb_comment  = "^\\s*/'"
    201 
    202   # OPTION EXPLICIT, without the leading underscore, is common to many dialects
    203   var qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)'
    204 
    205   for lnum in range(1, min([line("$"), 100]))
    206     var line = getline(lnum)
    207     if line =~ ft_visual_basic_content
    208       setf vb
    209       return
    210     elseif line =~ fb_preproc || line =~ fb_comment || line =~ fb_keywords
    211       setf freebasic
    212       return
    213     elseif line =~ qb64_preproc
    214       setf qb64
    215       return
    216     endif
    217   endfor
    218   setf basic
    219 enddef
    220 
    221 export def FTbtm()
    222   if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
    223     setf dosbatch
    224   else
    225     setf btm
    226   endif
    227 enddef
    228 
    229 export def BindzoneCheck(default = '')
    230   if getline(1) .. getline(2) .. getline(3) .. getline(4)
    231 	  =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA'
    232     setf bindzone
    233   elseif default != ''
    234     exe 'setf ' .. default
    235   endif
    236 enddef
    237 
    238 # Returns true if file content looks like RAPID
    239 def IsRapid(sChkExt: string = ""): bool
    240   if sChkExt == "cfg"
    241     return getline(1) =~? '\v^%(EIO|MMC|MOC|PROC|SIO|SYS):CFG'
    242   endif
    243   # called from FTmod, FTprg or FTsys
    244   return getline(nextnonblank(1)) =~? '\v^\s*%(\%{3}|module\s+\k+\s*%(\(|$))'
    245 enddef
    246 
    247 export def FTcfg()
    248   if exists("g:filetype_cfg")
    249     exe "setf " .. g:filetype_cfg
    250   elseif IsRapid("cfg")
    251     setf rapid
    252   else
    253     setf cfg
    254   endif
    255 enddef
    256 
    257 export def FTcl()
    258   if join(getline(1, 4), '') =~ '/\*'
    259     setf opencl
    260   else
    261     setf lisp
    262   endif
    263 enddef
    264 
    265 # Determines whether a *.cls file is ObjectScript, TeX, Rexx, Visual Basic, or Smalltalk.
    266 export def FTcls()
    267   if exists("g:filetype_cls")
    268     exe "setf " .. g:filetype_cls
    269     return
    270   endif
    271 
    272   var line1 = getline(1)
    273   if line1 =~ '^#!.*\<\%(rexx\|regina\)\>'
    274     setf rexx
    275     return
    276   elseif line1 == 'VERSION 1.0 CLASS'
    277     setf vb
    278     return
    279   endif
    280 
    281   var nonblank1 = getline(nextnonblank(1))
    282   var lnum = nextnonblank(1)
    283   while lnum > 0 && lnum <= line("$")
    284     var line = getline(lnum)
    285     if line =~? '^\s*\%(import\|include\|includegenerator\)\>'
    286       lnum = nextnonblank(lnum + 1)
    287     else
    288       nonblank1 = line
    289       break
    290     endif
    291   endwhile
    292 
    293   if nonblank1 =~? '^\s*class\>\s\+[%A-Za-z][%A-Za-z0-9_.]*\%(\s\+extends\>\|\s*\[\|\s*{\|$\)'
    294     setf objectscript
    295   elseif nonblank1 =~ '^\v%(\%|\\)'
    296     setf tex
    297   elseif nonblank1 =~ '^\s*\%(/\*\|::\w\)'
    298     setf rexx
    299   else
    300     setf st
    301   endif
    302 enddef
    303 
    304 export def FTll()
    305   if getline(1) =~ ';\|\<source_filename\>\|\<target\>'
    306     setf llvm
    307     return
    308   endif
    309   var n = 1
    310   while n < 100 && n <= line("$")
    311     var line = getline(n)
    312     if line =~ '^\s*%'
    313       setf lex
    314       return
    315     endif
    316     n += 1
    317   endwhile
    318   setf lifelines
    319 enddef
    320 
    321 export def FTlpc()
    322   if exists("g:lpc_syntax_for_c")
    323     var lnum = 1
    324     while lnum <= 12
    325       if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
    326 	setf lpc
    327 	return
    328       endif
    329       lnum += 1
    330     endwhile
    331   endif
    332   setf c
    333 enddef
    334 
    335 # Searches within the first `maxlines` lines of the file for distinctive
    336 # Objective-C or C++ syntax and returns the appropriate filetype. Returns a
    337 # null_string if the search was inconclusive.
    338 def CheckObjCOrCpp(maxlines = 100): string
    339   var n = 1
    340   while n < maxlines && n <= line('$')
    341     const line = getline(n)
    342     if line =~ '\v^\s*\@%(class|interface|end)>'
    343       return 'objcpp'
    344     elseif line =~ '\v^\s*%(class|namespace|template|using)>'
    345       return 'cpp'
    346     endif
    347     ++n
    348   endwhile
    349   return null_string
    350 enddef
    351 
    352 # Determines whether a *.h file is C, C++, Ch, or Objective-C/Objective-C++.
    353 export def FTheader()
    354   if exists('g:filetype_h')
    355     execute $'setf {g:filetype_h}'
    356   elseif exists('g:c_syntax_for_h')
    357     setf c
    358   elseif exists('g:ch_syntax_for_h')
    359     setf ch
    360   else
    361     # Search the first 100 lines of the file for distinctive Objective-C or C++
    362     # syntax and set the filetype accordingly. Otherwise, use C as the default
    363     # filetype.
    364     execute $'setf {CheckObjCOrCpp() ?? 'c'}'
    365   endif
    366 enddef
    367 
    368 # This function checks if one of the first ten lines start with a '@'.  In
    369 # that case it is probably a change file.
    370 # If the first line starts with # or ! it's probably a ch file.
    371 # If a line has "main", "include", "//" or "/*" it's probably ch.
    372 # Otherwise CHILL is assumed.
    373 export def FTchange()
    374   var lnum = 1
    375   while lnum <= 10
    376     if getline(lnum)[0] == '@'
    377       setf change
    378       return
    379     endif
    380     if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
    381       setf ch
    382       return
    383     endif
    384     if getline(lnum) =~ "MODULE"
    385       setf chill
    386       return
    387     endif
    388     if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
    389       setf ch
    390       return
    391     endif
    392     lnum += 1
    393   endwhile
    394   setf chill
    395 enddef
    396 
    397 export def FTent()
    398   # This function checks for valid cl syntax in the first five lines.
    399   # Look for either an opening comment, '#', or a block start, '{'.
    400   # If not found, assume SGML.
    401   var lnum = 1
    402   while lnum < 6
    403     var line = getline(lnum)
    404     if line =~ '^\s*[#{]'
    405       setf cl
    406       return
    407     elseif line !~ '^\s*$'
    408       # Not a blank line, not a comment, and not a block start,
    409       # so doesn't look like valid cl code.
    410       break
    411     endif
    412     lnum += 1
    413   endwhile
    414   setf dtd
    415 enddef
    416 
    417 export def ExCheck()
    418   var lines = getline(1, min([line("$"), 100]))
    419   if exists('g:filetype_euphoria')
    420     exe 'setf ' .. g:filetype_euphoria
    421   elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1
    422     setf euphoria3
    423   else
    424     setf elixir
    425   endif
    426 enddef
    427 
    428 export def EuphoriaCheck()
    429   if exists('g:filetype_euphoria')
    430     exe 'setf ' .. g:filetype_euphoria
    431   else
    432     setf euphoria3
    433   endif
    434 enddef
    435 
    436 export def DtraceCheck()
    437   if did_filetype()
    438     # Filetype was already detected
    439     return
    440   endif
    441   var lines = getline(1, min([line("$"), 100]))
    442   if match(lines, '^module\>\|^import\>') > -1
    443     # D files often start with a module and/or import statement.
    444     setf d
    445   elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1
    446     setf dtrace
    447   else
    448     setf d
    449   endif
    450 enddef
    451 
    452 export def FTdef()
    453   # LaTeX def files are usually generated by docstrip, which will output '%%' in first line
    454   if getline(1) =~ '%%'
    455     setf tex
    456   endif
    457   if get(g:, "filetype_def", "") == "modula2" || IsModula2()
    458     SetFiletypeModula2()
    459     return
    460   endif
    461 
    462   if exists("g:filetype_def")
    463     exe "setf " .. g:filetype_def
    464   else
    465     setf def
    466   endif
    467 enddef
    468 
    469 export def FTe()
    470   if exists('g:filetype_euphoria')
    471     exe 'setf ' .. g:filetype_euphoria
    472   else
    473     var n = 1
    474     while n < 100 && n <= line("$")
    475       if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
    476 	setf specman
    477 	return
    478       endif
    479       n += 1
    480     endwhile
    481     setf eiffel
    482   endif
    483 enddef
    484 
    485 def IsForth(): bool
    486   var first_line = nextnonblank(1)
    487 
    488   # SwiftForth block comment (line is usually filled with '-' or '=') or
    489   # OPTIONAL (sometimes precedes the header comment)
    490   if getline(first_line) =~? '^\%({\%(\s\|$\)\|OPTIONAL\s\)'
    491     return true
    492   endif
    493 
    494   var n = first_line
    495   while n < 100 && n <= line("$")
    496     # Forth comments and colon definitions
    497     if getline(n) =~ '^[:(\\] '
    498       return true
    499     endif
    500     n += 1
    501   endwhile
    502   return false
    503 enddef
    504 
    505 # Distinguish between Forth and Fortran
    506 export def FTf()
    507   if exists("g:filetype_f")
    508     exe "setf " .. g:filetype_f
    509   elseif IsForth()
    510     setf forth
    511   else
    512     setf fortran
    513   endif
    514 enddef
    515 
    516 export def FTfrm()
    517   if exists("g:filetype_frm")
    518     exe "setf " .. g:filetype_frm
    519     return
    520   endif
    521 
    522   if getline(1) == "VERSION 5.00"
    523     setf vb
    524     return
    525   endif
    526 
    527   var lines = getline(1, min([line("$"), 5]))
    528 
    529   if match(lines, ft_visual_basic_content) > -1
    530     setf vb
    531   else
    532     setf form
    533   endif
    534 enddef
    535 
    536 # Distinguish between Forth and F#
    537 export def FTfs()
    538   if exists("g:filetype_fs")
    539     exe "setf " .. g:filetype_fs
    540   elseif IsForth()
    541     setf forth
    542   else
    543     setf fsharp
    544   endif
    545 enddef
    546 
    547 # Recursively searches for Hare source files within a directory, up to a given
    548 # depth.
    549 def IsHareModule(dir: string, depth: number): bool
    550   if depth < 1
    551     return false
    552   elseif depth == 1
    553     return !glob(dir .. '/*.ha')->empty()
    554   endif
    555 
    556   # Check all files in the directory before recursing into subdirectories.
    557   const items = glob(dir .. '/*', true, true)
    558     ->sort((a, b) => isdirectory(a) - isdirectory(b))
    559   for n in items
    560     if isdirectory(n)
    561       if IsHareModule(n, depth - 1)
    562         return true
    563       endif
    564     elseif n =~ '\.ha$'
    565       return true
    566     endif
    567   endfor
    568 
    569   return false
    570 enddef
    571 
    572 # Determines whether a README file is inside a Hare module and should receive
    573 # the 'haredoc' filetype.
    574 export def FTharedoc()
    575   if IsHareModule('<afile>:h', get(g:, 'filetype_haredoc', 1))
    576     setf haredoc
    577   endif
    578 enddef
    579 
    580 # Distinguish between HTML, XHTML, Django and Angular
    581 export def FThtml()
    582   var n = 1
    583 
    584   # Test if the filename follows the Angular component template convention
    585   # Disabled for the reasons mentioned here: #13594
    586   # if expand('%:t') =~ '^.*\.component\.html$'
    587   #   setf htmlangular
    588   #   return
    589   # endif
    590 
    591   while n < 40 && n <= line("$")
    592     # Check for Angular
    593     if getline(n) =~ '@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|\<ng-template\|\<ng-content'
    594       setf htmlangular
    595       return
    596     endif
    597     # Check for XHTML
    598     if getline(n) =~ '\<DTD\s\+XHTML\s'
    599       setf xhtml
    600       return
    601     endif
    602     # Check for Django
    603     if getline(n) =~ '{%\s*\(autoescape\|block\|comment\|csrf_token\|cycle\|debug\|extends\|filter\|firstof\|for\|if\|ifchanged\|include\|load\|lorem\|now\|query_string\|regroup\|resetcycle\|spaceless\|templatetag\|url\|verbatim\|widthratio\|with\)\>\|{#\s\+'
    604       setf htmldjango
    605       return
    606     endif
    607     # Check for SuperHTML
    608     if getline(n) =~ '<extend\|<super>'
    609         setf superhtml
    610         return
    611     endif
    612     n += 1
    613   endwhile
    614   setf FALLBACK html
    615 enddef
    616 
    617 # Distinguish between standard IDL and MS-IDL
    618 export def FTidl()
    619   var n = 1
    620   while n < 50 && n <= line("$")
    621     if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
    622       setf msidl
    623       return
    624     endif
    625     n += 1
    626   endwhile
    627   setf idl
    628 enddef
    629 
    630 # Distinguish between "default", Prolog, zsh module's C and Cproto prototype file.
    631 export def ProtoCheck(default: string)
    632   # zsh modules use '#include "*.pro"'
    633   # https://github.com/zsh-users/zsh/blob/63f086d167960a27ecdbcb762179e2c2bf8a29f5/Src/Modules/example.c#L31
    634   if getline(1) =~ '/* Generated automatically */'
    635     setf c
    636   # Cproto files have a comment in the first line and a function prototype in
    637   # the second line, it always ends in ";".  Indent files may also have
    638   # comments, thus we can't match comments to see the difference.
    639   # IDL files can have a single ';' in the second line, require at least one
    640   # chacter before the ';'.
    641   elseif getline(2) =~ '.;$'
    642     setf cpp
    643   else
    644     # recognize Prolog by specific text in the first non-empty line
    645     # require a blank after the '%' because Perl uses "%list" and "%translate"
    646     var lnum = getline(nextnonblank(1))
    647     if lnum =~ '\<prolog\>' || lnum =~ prolog_pattern
    648       setf prolog
    649     else
    650       exe 'setf ' .. default
    651     endif
    652   endif
    653 enddef
    654 
    655 export def FTm()
    656   if exists("g:filetype_m")
    657     exe "setf " .. g:filetype_m
    658     return
    659   endif
    660 
    661   # excluding end(for|function|if|switch|while) common to Murphi
    662   var octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
    663 
    664   var objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
    665 
    666   var n = 1
    667   var saw_comment = 0  # Whether we've seen a multiline comment leader.
    668   while n < 100
    669     var line = getline(n)
    670     if line =~ '^\s*/\*'
    671       # /* ... */ is a comment in Objective C and Murphi, so we can't conclude
    672       # it's either of them yet, but track this as a hint in case we don't see
    673       # anything more definitive.
    674       saw_comment = 1
    675     endif
    676     if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
    677       setf objc
    678       return
    679     endif
    680     if line =~ '^\s*\%(#\|%!\)' || line =~ '^\s*unwind_protect\>' ||
    681 	  \ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
    682       setf octave
    683       return
    684     endif
    685     # TODO: could be Matlab or Octave
    686     if line =~ '^\s*%'
    687       setf matlab
    688       return
    689     endif
    690     if line =~ '^\s*(\*'
    691       setf mma
    692       return
    693     endif
    694     if line =~ '^\c\s*\(\(type\|var\)\>\|--\)'
    695       setf murphi
    696       return
    697     endif
    698     n += 1
    699   endwhile
    700 
    701   if saw_comment
    702     # We didn't see anything definitive, but this looks like either Objective C
    703     # or Murphi based on the comment leader. Assume the former as it is more
    704     # common.
    705     setf objc
    706   else
    707     # Default is Matlab
    708     setf matlab
    709   endif
    710 enddef
    711 
    712 # For files ending in *.m4, distinguish:
    713 #  – *.html.m4 files
    714 #  - *fvwm2rc*.m4 files
    715 #  – files in the Autoconf M4 dialect
    716 #  – files in POSIX M4
    717 export def FTm4()
    718   var fname = expand('%:t')
    719   var path  = expand('%:p:h')
    720 
    721   if fname =~# 'html\.m4$'
    722     setf htmlm4
    723     return
    724   endif
    725 
    726   if fname =~# 'fvwm2rc'
    727     setf fvwm2m4
    728     return
    729   endif
    730 
    731   # Canonical Autoconf file
    732   if fname ==# 'aclocal.m4'
    733     setf config
    734     return
    735   endif
    736 
    737   # Repo heuristic for Autoconf M4 (nearby configure.ac)
    738   if filereadable(path .. '/../configure.ac') || filereadable(path .. '/configure.ac')
    739     setf config
    740     return
    741   endif
    742 
    743   # Content heuristic for Autoconf M4 (scan first ~200 lines)
    744   # Signals:
    745   #   - Autoconf macro prefixes: AC_/AM_/AS_/AU_/AT_
    746   var n = 1
    747   var max = min([200, line('$')])
    748   while n <= max
    749     var line = getline(n)
    750     if line =~# '^\s*A[CMSUT]_'
    751       setf config
    752       return
    753     endif
    754     n += 1
    755   endwhile
    756 
    757   # Default to POSIX M4
    758   setf m4
    759 enddef
    760 
    761 export def FTmake()
    762   # Check if it is a BSD, GNU, or Microsoft Makefile
    763   unlet! b:make_flavor
    764 
    765   # 1. filename
    766   if expand('%:t') == 'BSDmakefile'
    767     b:make_flavor = 'bsd'
    768     setf make
    769     return
    770   elseif expand('%:t') == 'GNUmakefile'
    771     b:make_flavor = 'gnu'
    772     setf make
    773     return
    774   endif
    775 
    776   # 2. user's setting
    777   if exists('g:make_flavor')
    778     b:make_flavor = g:make_flavor
    779     setf make
    780     return
    781   elseif get(g:, 'make_microsoft')
    782     echom "make_microsoft is deprecated; try g:make_flavor = 'microsoft' instead"
    783     b:make_flavor = 'microsoft'
    784     setf make
    785     return
    786   endif
    787 
    788   # 3. try to detect a flavor from file content
    789   var n = 1
    790   while n < 1000 && n <= line('$')
    791     var line = getline(n)
    792     if line =~? '^\s*!\s*\(ifn\=\(def\)\=\|include\|message\|error\)\>'
    793       b:make_flavor = 'microsoft'
    794       break
    795     elseif line =~ '^\.\%(export\|error\|for\|if\%(n\=\%(def\|make\)\)\=\|info\|warning\)\>'
    796       b:make_flavor = 'bsd'
    797       break
    798     elseif line =~ '^ *\%(ifn\=\%(eq\|def\)\|define\|override\)\>'
    799       b:make_flavor = 'gnu'
    800       break
    801     elseif line =~ '\$[({][a-z-]\+\s\+\S\+'  # a function call, e.g. $(shell pwd)
    802       b:make_flavor = 'gnu'
    803       break
    804     endif
    805     n += 1
    806   endwhile
    807   setf make
    808 enddef
    809 
    810 export def FTmms()
    811   var n = 1
    812   while n < 20
    813     var line = getline(n)
    814     if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
    815       setf mmix
    816       return
    817     endif
    818     if line =~ '^\s*#'
    819       setf make
    820       return
    821     endif
    822     n += 1
    823   endwhile
    824   setf mmix
    825 enddef
    826 
    827 # This function checks if one of the first five lines start with a typical
    828 # nroff pattern in man files.  In that case it is probably an nroff file:
    829 # 'filetype' is set and 1 is returned.
    830 export def FTnroff(): number
    831   var n = 1
    832   while n <= 5
    833     var line = getline(n)
    834     if line =~ '^\%([.'']\s*\%(TH\|D[dt]\|S[Hh]\|d[es]1\?\|so\)\s\+\S\|[.'']\s*ig\>\|\%([.'']\s*\)\?\\"\)'
    835       setf nroff
    836       return 1
    837     endif
    838     n += 1
    839   endwhile
    840   return 0
    841 enddef
    842 
    843 export def FTmm()
    844   if exists("g:filetype_mm")
    845     exe "setf " .. g:filetype_mm
    846     return
    847   endif
    848 
    849   var n = 1
    850   while n < 20
    851     if getline(n) =~ '^\s*\(//\|#\s*\(include\|import\)\>\|@import\>\|/\*\)'
    852       setf objcpp
    853       return
    854     endif
    855     n += 1
    856   endwhile
    857   setf nroff
    858 enddef
    859 
    860 # Returns true if file content looks like LambdaProlog module
    861 def IsLProlog(): bool
    862   # skip apparent comments and blank lines, what looks like
    863   # LambdaProlog comment may be RAPID header
    864   var lnum: number = nextnonblank(1)
    865   while lnum > 0 && lnum < line('$') && getline(lnum) =~ '^\s*%' # LambdaProlog comment
    866     lnum = nextnonblank(lnum + 1)
    867   endwhile
    868   # this pattern must not catch a go.mod file
    869   return getline(lnum) =~ '\<module\s\+\w\+\s*\.\s*\(%\|$\)'
    870 enddef
    871 
    872 def IsModula2(): bool
    873   return getline(nextnonblank(1)) =~ '\<MODULE\s\+\w\+\s*\%(\[.*]\s*\)\=;\|^\s*(\*'
    874 enddef
    875 
    876 def SetFiletypeModula2()
    877   const KNOWN_DIALECTS = ["iso", "pim", "r10"]
    878   const KNOWN_EXTENSIONS = ["gm2"]
    879   const LINE_COUNT = 200
    880   const TAG = '(\*!m2\(\w\+\)\%(+\(\w\+\)\)\=\*)'
    881 
    882   var dialect = get(g:, "modula2_default_dialect", "pim")
    883   var extension = get(g:, "modula2_default_extension", "")
    884 
    885   var matches = []
    886 
    887   # ignore unknown dialects or badly formatted tags
    888   for lnum in range(1, min([line("$"), LINE_COUNT]))
    889     matches = matchlist(getline(lnum), TAG)
    890     if !empty(matches)
    891       if index(KNOWN_DIALECTS, matches[1]) >= 0
    892          dialect = matches[1]
    893       endif
    894       if index(KNOWN_EXTENSIONS, matches[2]) >= 0
    895          extension = matches[2]
    896       endif
    897       break
    898     endif
    899   endfor
    900 
    901   modula2#SetDialect(dialect, extension)
    902 
    903   setf modula2
    904 enddef
    905 
    906 # Determine if *.mod is ABB RAPID, LambdaProlog, Modula-2, Modsim III or go.mod
    907 export def FTmod()
    908   if get(g:, "filetype_mod", "") == "modula2" || IsModula2()
    909     SetFiletypeModula2()
    910     return
    911   endif
    912 
    913   if exists("g:filetype_mod")
    914     exe "setf " .. g:filetype_mod
    915   elseif expand("<afile>") =~ '\<go.mod$'
    916     setf gomod
    917   elseif IsLProlog()
    918     setf lprolog
    919   elseif IsRapid()
    920     setf rapid
    921   else
    922     # Nothing recognized, assume modsim3
    923     setf modsim3
    924   endif
    925 enddef
    926 
    927 export def FTpl()
    928   if exists("g:filetype_pl")
    929     exe "setf " .. g:filetype_pl
    930   else
    931     # recognize Prolog by specific text in the first non-empty line
    932     # require a blank after the '%' because Perl uses "%list" and "%translate"
    933     var line = getline(nextnonblank(1))
    934     if line =~ '\<prolog\>' || line =~ prolog_pattern
    935       setf prolog
    936     else
    937       setf perl
    938     endif
    939   endif
    940 enddef
    941 
    942 export def FTinc()
    943   if exists("g:filetype_inc")
    944     exe "setf " .. g:filetype_inc
    945   else
    946     if IsObjectScriptRoutine()
    947       setf objectscript_routine
    948       return
    949     endif
    950     for lnum in range(1, min([line("$"), 20]))
    951       var line = getline(lnum)
    952       if line =~? "perlscript"
    953         setf aspperl
    954         return
    955       elseif line =~ "<%"
    956         setf aspvbs
    957         return
    958       elseif line =~ "<?"
    959         setf php
    960         return
    961       # Pascal supports // comments but they're vary rarely used for file
    962       # headers so assume POV-Ray
    963       elseif line =~ '^\s*\%({\|(\*\)' || line =~? ft_pascal_keywords
    964         setf pascal
    965         return
    966       elseif line =~# '^\s*\<\%(require\|inherit\)\>' || line =~# '^\s*[A-Z][A-Za-z0-9_:${}/]*\%(\[[A-Za-z0-9_:/]\+\]\)*\s\+\%(??=\|[?:+.]=\|=[+.]\?\)\s\+'
    967         setf bitbake
    968         return
    969       endif
    970     endfor
    971     FTasmsyntax()
    972     if exists("b:asmsyntax")
    973       exe "setf " .. fnameescape(b:asmsyntax)
    974     else
    975       setf pov
    976     endif
    977   endif
    978 enddef
    979 
    980 export def FTprogress_cweb()
    981   if exists("g:filetype_w")
    982     exe "setf " .. g:filetype_w
    983     return
    984   endif
    985   if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
    986     setf progress
    987   else
    988     setf cweb
    989   endif
    990 enddef
    991 
    992 # These include the leading '%' sign
    993 var ft_swig_keywords = '^\s*%\%(addmethods\|apply\|beginfile\|clear\|constant\|define\|echo\|enddef\|endoffile\|extend\|feature\|fragment\|ignore\|import\|importfile\|include\|includefile\|inline\|insert\|keyword\|module\|name\|namewarn\|native\|newobject\|parms\|pragma\|rename\|template\|typedef\|typemap\|types\|varargs\|warn\)'
    994 # This is the start/end of a block that is copied literally to the processor file (C/C++)
    995 var ft_swig_verbatim_block_start = '^\s*%{'
    996 
    997 export def FTi()
    998   if exists("g:filetype_i")
    999     exe "setf " .. g:filetype_i
   1000     return
   1001   endif
   1002   # This function checks for an assembly comment or a SWIG keyword or verbatim block in the first 50 lines.
   1003   # If not found, assume Progress.
   1004   var lnum = 1
   1005   while lnum <= 50 && lnum < line('$')
   1006     var line = getline(lnum)
   1007     if line =~ '^\s*;' || line =~ '^\*'
   1008       FTasm()
   1009       return
   1010     elseif line =~ ft_swig_keywords || line =~ ft_swig_verbatim_block_start
   1011       setf swig
   1012       return
   1013     endif
   1014     lnum += 1
   1015   endwhile
   1016   setf progress
   1017 enddef
   1018 
   1019 export def FTint()
   1020   if exists("g:filetype_int")
   1021     exe "setf " .. g:filetype_int
   1022   elseif IsObjectScriptRoutine()
   1023     setf objectscript_routine
   1024   else
   1025     setf hex
   1026   endif
   1027 enddef
   1028 
   1029 var ft_pascal_comments = '^\s*\%({\|(\*\|//\)'
   1030 var ft_pascal_keywords = '^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>'
   1031 
   1032 export def FTprogress_pascal()
   1033   if exists("g:filetype_p")
   1034     exe "setf " .. g:filetype_p
   1035     return
   1036   endif
   1037   # This function checks for valid Pascal syntax in the first ten lines.
   1038   # Look for either an opening comment or a program start.
   1039   # If not found, assume Progress.
   1040   var lnum = 1
   1041   while lnum <= 10 && lnum < line('$')
   1042     var line = getline(lnum)
   1043     if line =~ ft_pascal_comments || line =~? ft_pascal_keywords
   1044       setf pascal
   1045       return
   1046     elseif line !~ '^\s*$' || line =~ '^/\*'
   1047       # Not an empty line: Doesn't look like valid Pascal code.
   1048       # Or it looks like a Progress /* comment
   1049       break
   1050     endif
   1051     lnum += 1
   1052   endwhile
   1053   setf progress
   1054 enddef
   1055 
   1056 export def FTpp()
   1057   if exists("g:filetype_pp")
   1058     exe "setf " .. g:filetype_pp
   1059   else
   1060     var line = getline(nextnonblank(1))
   1061     if line =~ ft_pascal_comments || line =~? ft_pascal_keywords
   1062       setf pascal
   1063     else
   1064       setf puppet
   1065     endif
   1066   endif
   1067 enddef
   1068 
   1069 # Determine if *.prg is ABB RAPID. Can also be Clipper, FoxPro or eviews
   1070 export def FTprg()
   1071   if exists("g:filetype_prg")
   1072     exe "setf " .. g:filetype_prg
   1073   elseif IsRapid()
   1074     setf rapid
   1075   else
   1076     # Nothing recognized, assume Clipper
   1077     setf clipper
   1078   endif
   1079 enddef
   1080 
   1081 export def FTr()
   1082   var max = line("$") > 50 ? 50 : line("$")
   1083 
   1084   for n in range(1, max)
   1085     # Rebol is easy to recognize, check for that first
   1086     if getline(n) =~? '\<REBOL\>'
   1087       setf rebol
   1088       return
   1089     endif
   1090   endfor
   1091 
   1092   for n in range(1, max)
   1093     # R has # comments
   1094     if getline(n) =~ '^\s*#'
   1095       setf r
   1096       return
   1097     endif
   1098     # Rexx has /* comments */
   1099     if getline(n) =~ '^\s*/\*'
   1100       setf rexx
   1101       return
   1102     endif
   1103   endfor
   1104 
   1105   # Nothing recognized, use user default or assume Rexx
   1106   if exists("g:filetype_r")
   1107     exe "setf " .. g:filetype_r
   1108   else
   1109     # Rexx used to be the default, but R appears to be much more popular.
   1110     setf r
   1111   endif
   1112 enddef
   1113 
   1114 export def McSetf()
   1115   # Rely on the file to start with a comment.
   1116   # MS message text files use ';', Sendmail files use '#' or 'dnl'
   1117   for lnum in range(1, min([line("$"), 20]))
   1118     var line = getline(lnum)
   1119     if line =~ '^\s*\(#\|dnl\)'
   1120       setf m4  # Sendmail .mc file
   1121       return
   1122     elseif line =~ '^\s*;'
   1123       setf msmessages  # MS Message text file
   1124       return
   1125     endif
   1126   endfor
   1127   setf m4  # Default: Sendmail .mc file
   1128 enddef
   1129 
   1130 # Called from filetype.vim and scripts.vim.
   1131 # When "setft" is passed and false then the 'filetype' option is not set.
   1132 export def SetFileTypeSH(name: string, setft = true): string
   1133   if setft && did_filetype()
   1134     # Filetype was already detected
   1135     return ''
   1136   endif
   1137   if setft && expand("<amatch>") =~ g:ft_ignore_pat
   1138     return ''
   1139   endif
   1140   if name =~ '^csh$' || name =~ '^#!.\{-2,}\<csh\>'
   1141     # Some .sh scripts contain #!/bin/csh.
   1142     return SetFileTypeShell("csh", setft)
   1143   elseif name =~ '^tcsh$' || name =~ '^#!.\{-2,}\<tcsh\>'
   1144     # Some .sh scripts contain #!/bin/tcsh.
   1145     return SetFileTypeShell("tcsh", setft)
   1146   elseif name =~ '^zsh$' || name =~ '^#!.\{-2,}\<zsh\>'
   1147     # Some .sh scripts contain #!/bin/zsh.
   1148     return SetFileTypeShell("zsh", setft)
   1149   elseif name =~ '^ksh$' || name =~ '^#!.\{-2,}\<ksh\>'
   1150     b:is_kornshell = 1
   1151     if exists("b:is_bash")
   1152       unlet b:is_bash
   1153     endif
   1154     if exists("b:is_sh")
   1155       unlet b:is_sh
   1156     endif
   1157   elseif exists("g:bash_is_sh") || name =~ '^bash2\=$' ||
   1158 	  \ name =~ '^#!.\{-2,}\<bash2\=\>'
   1159     b:is_bash = 1
   1160     if exists("b:is_kornshell")
   1161       unlet b:is_kornshell
   1162     endif
   1163     if exists("b:is_sh")
   1164       unlet b:is_sh
   1165     endif
   1166   elseif name =~ '^\%(da\)\=sh$' || name =~ '^#!.\{-2,}\<\%(da\)\=sh\>'
   1167     # Ubuntu links "sh" to "dash", thus it is expected to work the same way
   1168     b:is_sh = 1
   1169     if exists("b:is_kornshell")
   1170       unlet b:is_kornshell
   1171     endif
   1172     if exists("b:is_bash")
   1173       unlet b:is_bash
   1174     endif
   1175   endif
   1176 
   1177   return SetFileTypeShell("sh", setft)
   1178 enddef
   1179 
   1180 # For shell-like file types, check for an "exec" command hidden in a comment,
   1181 # as used for Tcl.
   1182 # When "setft" is passed and false then the 'filetype' option is not set.
   1183 # Also called from scripts.vim, thus can't be local to this script.
   1184 export def SetFileTypeShell(name: string, setft = true): string
   1185   if setft && did_filetype()
   1186     # Filetype was already detected
   1187     return ''
   1188   endif
   1189   if setft && expand("<amatch>") =~ g:ft_ignore_pat
   1190     return ''
   1191   endif
   1192 
   1193   var lnum = 2
   1194   while lnum < 20 && lnum < line("$") && getline(lnum) =~ '^\s*\(#\|$\)'
   1195     # Skip empty and comment lines.
   1196     lnum += 1
   1197   endwhile
   1198   if lnum < line("$") && getline(lnum) =~ '\s*exec\s' && getline(lnum - 1) =~ '^\s*#.*\\$'
   1199     # Found an "exec" line after a comment with continuation
   1200     var n = substitute(getline(lnum), '\s*exec\s\+\([^ ]*/\)\=', '', '')
   1201     if n =~ '\<tclsh\|\<wish'
   1202       if setft
   1203 	setf tcl
   1204       endif
   1205       return 'tcl'
   1206     endif
   1207   endif
   1208 
   1209   if setft
   1210     exe "setf " .. name
   1211   endif
   1212   return name
   1213 enddef
   1214 
   1215 export def CSH()
   1216   if did_filetype()
   1217     # Filetype was already detected
   1218     return
   1219   endif
   1220   if exists("g:filetype_csh")
   1221     SetFileTypeShell(g:filetype_csh)
   1222   elseif &shell =~ "tcsh"
   1223     SetFileTypeShell("tcsh")
   1224   else
   1225     SetFileTypeShell("csh")
   1226   endif
   1227 enddef
   1228 
   1229 var ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
   1230 export def FTRules()
   1231   var path = expand('<amatch>:p')
   1232   if path =~ '/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|\%(usr/\)\=lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
   1233     setf udevrules
   1234     return
   1235   endif
   1236   if path =~ '^/etc/ufw/'
   1237     setf conf  # Better than hog
   1238     return
   1239   endif
   1240   if path =~ '^/\(etc\|usr/share\)/polkit-1/rules\.d'
   1241     setf javascript
   1242     return
   1243   endif
   1244   var config_lines: list<string>
   1245   try
   1246     config_lines = readfile('/etc/udev/udev.conf')
   1247   catch /^Vim\%((\a\+)\)\=:E484/
   1248     setf hog
   1249     return
   1250   endtry
   1251   var dir = expand('<amatch>:p:h')
   1252   for line in config_lines
   1253     if line =~ ft_rules_udev_rules_pattern
   1254       var udev_rules = substitute(line, ft_rules_udev_rules_pattern, '\1', "")
   1255       if dir == udev_rules
   1256 	setf udevrules
   1257       endif
   1258       break
   1259     endif
   1260   endfor
   1261   setf hog
   1262 enddef
   1263 
   1264 export def SQL()
   1265   if exists("g:filetype_sql")
   1266     exe "setf " .. g:filetype_sql
   1267   else
   1268     setf sql
   1269   endif
   1270 enddef
   1271 
   1272 export def FTsa()
   1273   if join(getline(1, 4), "\n") =~# '\%(^\|\n\);'
   1274     setf tiasm
   1275     return
   1276   endif
   1277   setf sather
   1278 enddef
   1279 
   1280 # This function checks the first 25 lines of file extension "sc" to resolve
   1281 # detection between scala and SuperCollider.
   1282 # NOTE: We don't check for 'Class : Method', as this can easily be confused
   1283 # 	with valid Scala like `val x : Int = 3`. So we instead only rely on
   1284 # 	checks that can't be confused.
   1285 export def FTsc()
   1286   for lnum in range(1, min([line("$"), 25]))
   1287     if getline(lnum) =~# 'var\s<\|classvar\s<\|\^this.*\||\w\+|\|+\s\w*\s{\|\*ar\s'
   1288       setf supercollider
   1289       return
   1290     endif
   1291   endfor
   1292   setf scala
   1293 enddef
   1294 
   1295 # This function checks the first line of file extension "scd" to resolve
   1296 # detection between scdoc and SuperCollider
   1297 export def FTscd()
   1298   if getline(1) =~# '\%^\S\+(\d[0-9A-Za-z]*)\%(\s\+\"[^"]*\"\%(\s\+\"[^"]*\"\)\=\)\=$'
   1299     setf scdoc
   1300   else
   1301     setf supercollider
   1302   endif
   1303 enddef
   1304 
   1305 # If the file has an extension of 't' and is in a directory 't' or 'xt' then
   1306 # it is almost certainly a Perl test file.
   1307 # If the first line starts with '#' and contains 'perl' it's probably a Perl
   1308 # file.
   1309 # (Slow test) If a file contains a 'use' statement then it is almost certainly
   1310 # a Perl file.
   1311 export def FTperl(): number
   1312   var dirname = expand("%:p:h:t")
   1313   if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt')
   1314     setf perl
   1315     return 1
   1316   endif
   1317   if getline(1)[0] == '#' && getline(1) =~ 'perl'
   1318     setf perl
   1319     return 1
   1320   endif
   1321   var save_cursor = getpos('.')
   1322   call cursor(1, 1)
   1323   var has_use = search('^use\s\s*\k', 'c', 30) > 0
   1324   call setpos('.', save_cursor)
   1325   if has_use
   1326     setf perl
   1327     return 1
   1328   endif
   1329   return 0
   1330 enddef
   1331 
   1332 # LambdaProlog and Standard ML signature files
   1333 export def FTsig()
   1334   if exists("g:filetype_sig")
   1335     exe "setf " .. g:filetype_sig
   1336     return
   1337   endif
   1338 
   1339   var lprolog_comment = '^\s*\%(/\*\|%\)'
   1340   var lprolog_keyword = '^\s*sig\s\+\a'
   1341   var sml_comment = '^\s*(\*'
   1342   var sml_keyword = '^\s*\%(signature\|structure\)\s\+\a'
   1343 
   1344   var line = getline(nextnonblank(1))
   1345 
   1346   if line =~ lprolog_comment || line =~# lprolog_keyword
   1347     setf lprolog
   1348   elseif line =~ sml_comment || line =~# sml_keyword
   1349     setf sml
   1350   endif
   1351 enddef
   1352 
   1353 # This function checks the first 100 lines of files matching "*.sil" to
   1354 # resolve detection between Swift Intermediate Language and SILE.
   1355 export def FTsil()
   1356   for lnum in range(1, [line('$'), 100]->min())
   1357     var line: string = getline(lnum)
   1358     if line =~ '^\s*[\\%]'
   1359       setf sile
   1360       return
   1361     elseif line =~ '^\s*\S'
   1362       setf sil
   1363       return
   1364     endif
   1365   endfor
   1366   # no clue, default to "sil"
   1367   setf sil
   1368 enddef
   1369 
   1370 export def FTsys()
   1371   if exists("g:filetype_sys")
   1372     exe "setf " .. g:filetype_sys
   1373   elseif IsRapid()
   1374     setf rapid
   1375   else
   1376     setf bat
   1377   endif
   1378 enddef
   1379 
   1380 # Choose context, plaintex, or tex (LaTeX) based on these rules:
   1381 # 1. Check the first line of the file for "%&<format>".
   1382 # 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
   1383 # 3. Default to "plain" or to g:tex_flavor, can be set in user's vimrc.
   1384 export def FTtex()
   1385   var firstline = getline(1)
   1386   var format: string
   1387   if firstline =~ '^%&\s*\a\+'
   1388     format = tolower(matchstr(firstline, '\a\+'))
   1389     format = substitute(format, 'pdf', '', '')
   1390     if format == 'tex'
   1391       format = 'latex'
   1392     elseif format == 'plaintex'
   1393       format = 'plain'
   1394     endif
   1395   elseif expand('%') =~ 'tex/context/.*/.*.tex'
   1396     format = 'context'
   1397   else
   1398     # Default value, may be changed later:
   1399     format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
   1400     # Save position, go to the top of the file, find first non-comment line.
   1401     var save_cursor = getpos('.')
   1402     call cursor(1, 1)
   1403     var firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
   1404     if firstNC > 0
   1405       # Check the next thousand lines for a LaTeX or ConTeXt keyword.
   1406       var lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
   1407       var cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
   1408       var kwline = search('^\s*\\\%(' .. lpat .. '\)\|^\s*\\\(' .. cpat .. '\)',
   1409 			      'cnp', firstNC + 1000)
   1410       if kwline == 1		# lpat matched
   1411 	format = 'latex'
   1412       elseif kwline == 2	# cpat matched
   1413 	format = 'context'
   1414       endif		# If neither matched, keep default set above.
   1415       # let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
   1416       # let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
   1417       # if cline > 0
   1418       #   let format = 'context'
   1419       # endif
   1420       # if lline > 0 && (cline == 0 || cline > lline)
   1421       #   let format = 'tex'
   1422       # endif
   1423     endif # firstNC
   1424     call setpos('.', save_cursor)
   1425   endif # firstline =~ '^%&\s*\a\+'
   1426 
   1427   # Translation from formats to file types.  TODO:  add AMSTeX, RevTex, others?
   1428   if format == 'plain'
   1429     setf plaintex
   1430   elseif format == 'context'
   1431     setf context
   1432   else # probably LaTeX
   1433     setf tex
   1434   endif
   1435   return
   1436 enddef
   1437 
   1438 export def FTxml()
   1439   var n = 1
   1440   while n < 100 && n <= line("$")
   1441     var line = getline(n)
   1442     # DocBook 4 or DocBook 5.
   1443     var is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
   1444     var is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"'
   1445     if is_docbook4 || is_docbook5
   1446       b:docbk_type = "xml"
   1447       if is_docbook5
   1448 	b:docbk_ver = 5
   1449       else
   1450 	b:docbk_ver = 4
   1451       endif
   1452       setf docbk
   1453       return
   1454     endif
   1455     if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"'
   1456       setf xbl
   1457       return
   1458     endif
   1459     n += 1
   1460   endwhile
   1461   setf xml
   1462 enddef
   1463 
   1464 export def FTy()
   1465   var n = 1
   1466   while n < 100 && n <= line("$")
   1467     var line = getline(n)
   1468     if line =~ '^\s*%'
   1469       setf yacc
   1470       return
   1471     endif
   1472     if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include'
   1473       setf racc
   1474       return
   1475     endif
   1476     n += 1
   1477   endwhile
   1478   setf yacc
   1479 enddef
   1480 
   1481 export def Redif()
   1482   var lnum = 1
   1483   while lnum <= 5 && lnum < line('$')
   1484     if getline(lnum) =~ "^\ctemplate-type:"
   1485       setf redif
   1486       return
   1487     endif
   1488     lnum += 1
   1489   endwhile
   1490 enddef
   1491 
   1492 # This function is called for all files under */debian/patches/*, make sure not
   1493 # to non-dep3patch files, such as README and other text files.
   1494 export def Dep3patch()
   1495   if expand('%:t') ==# 'series'
   1496     return
   1497   endif
   1498 
   1499   for ln in getline(1, 100)
   1500     if ln =~# '^\%(Description\|Subject\|Origin\|Bug\|Forwarded\|Author\|From\|Reviewed-by\|Acked-by\|Last-Updated\|Applied-Upstream\):'
   1501       setf dep3patch
   1502       return
   1503     elseif ln =~# '^---'
   1504       # end of headers found. stop processing
   1505       return
   1506     endif
   1507   endfor
   1508 enddef
   1509 
   1510 # This function checks the first 15 lines for appearance of 'FoamFile'
   1511 # and then 'object' in a following line.
   1512 # In that case, it's probably an OpenFOAM file
   1513 export def FTfoam()
   1514     var ffile = 0
   1515     var lnum = 1
   1516     while lnum <= 15
   1517       if getline(lnum) =~# '^FoamFile'
   1518 	ffile = 1
   1519       elseif ffile == 1 && getline(lnum) =~# '^\s*object'
   1520 	setf foam
   1521 	return
   1522       endif
   1523       lnum += 1
   1524     endwhile
   1525 enddef
   1526 
   1527 # Determine if a *.tf file is TF mud client or terraform
   1528 export def FTtf()
   1529   if exists("g:filetype_tf")
   1530     exe "setf " .. g:filetype_tf
   1531     return
   1532   endif
   1533 
   1534   var continuation: bool = false
   1535   for lnum in range(1, min([line("$"), 100]))
   1536     var line = getline(lnum)
   1537     # TF supports backslash line continuation, so a continued line may begin
   1538     # with any character.  Only test the first character of a line that does
   1539     # not continue a previous one.
   1540     if !continuation
   1541       var firstchar = trim(line)[0]
   1542       if firstchar !=? ";" && firstchar !=? "/" && firstchar !=? ""
   1543         setf terraform
   1544         return
   1545       endif
   1546     endif
   1547     continuation = line =~ '\\$'
   1548   endfor
   1549   setf tf
   1550 enddef
   1551 
   1552 var ft_krl_header = '\&\w+'
   1553 # Determine if a *.src file is Kuka Robot Language
   1554 export def FTsrc()
   1555   var ft_krl_def_or_deffct = '%(global\s+)?def%(fct)?>'
   1556   if exists("g:filetype_src")
   1557     exe "setf " .. g:filetype_src
   1558   elseif getline(nextnonblank(1)) =~? '\v^\s*%(' .. ft_krl_header .. '|' .. ft_krl_def_or_deffct .. ')'
   1559     setf krl
   1560   endif
   1561 enddef
   1562 
   1563 # Determine if a *.dat file is Kuka Robot Language
   1564 export def FTdat()
   1565   var ft_krl_defdat = 'defdat>'
   1566   if exists("g:filetype_dat")
   1567     exe "setf " .. g:filetype_dat
   1568   elseif getline(nextnonblank(1)) =~? '\v^\s*%(' .. ft_krl_header .. '|' .. ft_krl_defdat .. ')'
   1569     setf krl
   1570   endif
   1571 enddef
   1572 
   1573 export def FTlsl()
   1574   if exists("g:filetype_lsl")
   1575     exe "setf " .. g:filetype_lsl
   1576   endif
   1577 
   1578   var line = getline(nextnonblank(1))
   1579   if line =~ '^\s*%' || line =~# ':\s*trait\s*$'
   1580     setf larch
   1581   else
   1582     setf lsl
   1583   endif
   1584 enddef
   1585 
   1586 export def FTtyp()
   1587   if exists("g:filetype_typ")
   1588     exe "setf " .. g:filetype_typ
   1589     return
   1590   endif
   1591 
   1592   # Look for SQL type definition syntax
   1593   for line in getline(1, 200)
   1594     # SQL type files may define the casing
   1595     if line =~ '^CASE\s\==\s\=\(SAME\|LOWER\|UPPER\|OPPOSITE\)$'
   1596       setf sql
   1597       return
   1598     endif
   1599 
   1600     # SQL type files may define some types as follows
   1601     if line =~ '^TYPE\s.*$'
   1602       setf sql
   1603       return
   1604     endif
   1605   endfor
   1606 
   1607   # Otherwise, affect the typst filetype
   1608   setf typst
   1609 enddef
   1610 
   1611 # Detect Microsoft Developer Studio Project files (Makefile) or Faust DSP
   1612 # files.
   1613 export def FTdsp()
   1614   if exists("g:filetype_dsp")
   1615     exe "setf " .. g:filetype_dsp
   1616     return
   1617   endif
   1618 
   1619   # Test the filename
   1620   if expand('%:t') =~ '^[mM]akefile.*$'
   1621     setf make
   1622     return
   1623   endif
   1624 
   1625   # Test the file contents
   1626   for line in getline(1, 200)
   1627     # Check for comment style
   1628     if line =~ '^#.*'
   1629       setf make
   1630       return
   1631     endif
   1632 
   1633     # Check for common lines
   1634     if line =~ '^.*Microsoft Developer Studio Project File.*$'
   1635       setf make
   1636       return
   1637     endif
   1638 
   1639     if line =~ '^!MESSAGE This is not a valid makefile\..+$'
   1640       setf make
   1641       return
   1642     endif
   1643 
   1644     # Check for keywords
   1645     if line =~ '^!(IF,ELSEIF,ENDIF).*$'
   1646       setf make
   1647       return
   1648     endif
   1649 
   1650     # Check for common assignments
   1651     if line =~ '^SOURCE=.*$'
   1652       setf make
   1653       return
   1654     endif
   1655   endfor
   1656 
   1657   # Otherwise, assume we have a Faust file
   1658   setf faust
   1659 enddef
   1660 
   1661 # Set the filetype of a *.v file to Verilog, V or Cog based on the first 500
   1662 # lines.
   1663 export def FTv()
   1664   if did_filetype()
   1665     # ":setf" will do nothing, bail out early
   1666     return
   1667   endif
   1668   if exists("g:filetype_v")
   1669     exe "setf " .. g:filetype_v
   1670     return
   1671   endif
   1672 
   1673   var in_comment = 0
   1674   for lnum in range(1, min([line("$"), 500]))
   1675     var line = getline(lnum)
   1676     # Skip Verilog and V comments (lines and blocks).
   1677     if line =~ '^\s*/\*'
   1678       # start comment block
   1679       in_comment = 1
   1680     endif
   1681     if in_comment == 1
   1682       if line =~ '\*/'
   1683         # end comment block
   1684         in_comment = 0
   1685       endif
   1686       # skip comment-block line
   1687       continue
   1688     endif
   1689     if line =~ '^\s*//'
   1690       # skip comment line
   1691       continue
   1692     endif
   1693 
   1694     # Coq: line ends with a '.' followed by an optional variable number of
   1695     # spaces or contains the start of a comment, but not inside a Verilog or V
   1696     # comment.
   1697     # Example: "Definition x := 10. (*".
   1698     if (line =~ '\.\s*$' && line !~ '/[/*]') || (line =~ '(\*' && line !~ '/[/*].*(\*')
   1699       setf coq
   1700       return
   1701     endif
   1702 
   1703     # Verilog: line ends with ';' followed by an optional variable number of
   1704     # spaces and an optional start of a comment.
   1705     # Example: " b <= a + 1; // Add 1".
   1706     # Alternatively: a module is defined: " module MyModule ( input )"
   1707     if line =~ ';\s*\(/[/*].*\)\?$' || line =~ '\C^\s*module\s\+\w\+\s*('
   1708       setf verilog
   1709       return
   1710     endif
   1711   endfor
   1712 
   1713   # No line matched, fall back to "v".
   1714   setf v
   1715 enddef
   1716 
   1717 export def FTvba()
   1718   if getline(1) =~ '^["#] Vimball Archiver'
   1719     setf vim
   1720   else
   1721     setf vb
   1722   endif
   1723 enddef
   1724 
   1725 export def Detect_UCI_statements(): bool
   1726   # Match a config or package statement at the start of the line.
   1727   const config_or_package_statement = '^\s*\(\(c\|config\)\|\(p\|package\)\)\s\+\S'
   1728   # Match a line that is either all blank or blank followed by a comment
   1729   const comment_or_blank = '^\s*\(#.*\)\?$'
   1730 
   1731   # Return true iff the file has a config or package statement near the
   1732   # top of the file and all preceding lines were comments or blank.
   1733   return getline(1) =~# config_or_package_statement
   1734   \   || getline(1) =~# comment_or_blank
   1735   \      && (   getline(2) =~# config_or_package_statement
   1736   \          || getline(2) =~# comment_or_blank
   1737   \             && getline(3) =~# config_or_package_statement
   1738   \         )
   1739 enddef
   1740 
   1741 export def DetectFromName()
   1742   const amatch = expand("<amatch>")
   1743   const name = fnamemodify(amatch, ':t')
   1744   const ft = get(ft_from_name, name, '')
   1745   if ft != ''
   1746     execute "setf " .. ft
   1747   endif
   1748 enddef
   1749 
   1750 export def DetectFromExt()
   1751   const amatch = expand("<amatch>")
   1752   var ext = fnamemodify(amatch, ':e')
   1753   const name = fnamemodify(amatch, ':t')
   1754   if ext == '' && name[0] == '.'
   1755     ext = name[1 : ]
   1756   endif
   1757   const ft =  get(ft_from_ext, ext, '')
   1758   if ft != ''
   1759     execute "setf " .. ft
   1760   endif
   1761 enddef
   1762 
   1763 # Key: extension of the file name. without `.`
   1764 # Value: filetype
   1765 const ft_from_ext = {
   1766   # 8th (Firth-derivative)
   1767   "8th": "8th",
   1768   # A-A-P recipe
   1769   "aap": "aap",
   1770   # ABAB/4
   1771   "abap": "abap",
   1772   # ABC music notation
   1773   "abc": "abc",
   1774   # ABEL
   1775   "abl": "abel",
   1776   # ABNF
   1777   "abnf": "abnf",
   1778   # AceDB
   1779   "wrm": "acedb",
   1780   # Ada (83, 9X, 95)
   1781   "adb": "ada",
   1782   "ads": "ada",
   1783   "ada": "ada",
   1784   # AHDL
   1785   "tdf": "ahdl",
   1786   # AIDL
   1787   "aidl": "aidl",
   1788   # Algol 68
   1789   "a68": "algol68",
   1790   # AMPL
   1791   "run": "ampl",
   1792   # ANTLR / PCCTS
   1793   "g": "pccts",
   1794   # ANTLR 4
   1795   "g4": "antlr4",
   1796   # Arduino
   1797   "ino": "arduino",
   1798   "pde": "arduino",
   1799   # Asymptote
   1800   "asy": "asy",
   1801   # XA65 MOS6510 cross assembler
   1802   "a65": "a65",
   1803   # Applescript
   1804   "applescript": "applescript",
   1805   "scpt": "applescript",
   1806   # Applix ELF
   1807   "am": "elf",
   1808   # Arc Macro Language
   1809   "aml": "aml",
   1810   # ART*Enterprise (formerly ART-IM)
   1811   "art": "art",
   1812   # AsciiDoc
   1813   "asciidoc": "asciidoc",
   1814   "adoc": "asciidoc",
   1815   # ASN.1
   1816   "asn": "asn",
   1817   "asn1": "asn",
   1818   # Assembly - Netwide
   1819   "nasm": "nasm",
   1820   # Assembly - Microsoft
   1821   "masm": "masm",
   1822   # Assembly - Macro (VAX)
   1823   "mar": "vmasm",
   1824   # Astro
   1825   "astro": "astro",
   1826   # Atlas
   1827   "atl": "atlas",
   1828   # Atom is based on XML
   1829   "atom": "xml",
   1830   # Authzed
   1831   "zed": "authzed",
   1832   # Autoit v3
   1833   "au3": "autoit",
   1834   # Autohotkey
   1835   "ahk": "autohotkey",
   1836   # Autotest .at files are actually Autoconf M4
   1837   "at": "config",
   1838   # Avenue
   1839   "ave": "ave",
   1840   # Awk
   1841   "awk": "awk",
   1842   "gawk": "awk",
   1843   # B
   1844   "mch": "b",
   1845   "ref": "b",
   1846   "imp": "b",
   1847   # Bass
   1848   "bass": "bass",
   1849   # IBasic file (similar to QBasic)
   1850   "iba": "ibasic",
   1851   "ibi": "ibasic",
   1852   # FreeBasic file (similar to QBasic)
   1853   "fb": "freebasic",
   1854   # Bazel rc file
   1855   "bazelrc": "bazelrc",
   1856   # Batch file for MSDOS. See dist#ft#FTsys for *.sys
   1857   "bat": "dosbatch",
   1858   # BC calculator
   1859   "bc": "bc",
   1860   # BDF font
   1861   "bdf": "bdf",
   1862   # Beancount
   1863   "bean": "beancount",
   1864   "beancount": "beancount",
   1865   # BibTeX bibliography database file
   1866   "bib": "bib",
   1867   # BibTeX Bibliography Style
   1868   "bst": "bst",
   1869   # Bicep
   1870   "bicep": "bicep",
   1871   "bicepparam": "bicep-params",
   1872   # BIND zone
   1873   "zone": "bindzone",
   1874   # Blank
   1875   "bl": "blank",
   1876   # Brighterscript
   1877   "bs": "brighterscript",
   1878   # Brightscript
   1879   "brs": "brightscript",
   1880   # BSDL
   1881   "bsd": "bsdl",
   1882   "bsdl": "bsdl",
   1883   # Bpftrace
   1884   "bt": "bpftrace",
   1885   # C3
   1886   "c3": "c3",
   1887   "c3i": "c3",
   1888   "c3t": "c3",
   1889   # Cairo
   1890   "cairo": "cairo",
   1891   # Cap'n Proto
   1892   "capnp": "capnp",
   1893   # Dockerfile
   1894   "containerfile": "dockerfile",
   1895   "Containerfile": "dockerfile",
   1896   "dockerfile": "dockerfile",
   1897   "Dockerfile": "dockerfile",
   1898   # Common Package Specification
   1899   "cps": "json",
   1900   # C#
   1901   "cs": "cs",
   1902   "csx": "cs",
   1903   "cake": "cs",
   1904   # CSDL
   1905   "csdl": "csdl",
   1906   # Ctags
   1907   "ctags": "conf",
   1908   # Cabal
   1909   "cabal": "cabal",
   1910   # Cedar
   1911   "cedar": "cedar",
   1912   # ChaiScript
   1913   "chai": "chaiscript",
   1914   # Chatito
   1915   "chatito": "chatito",
   1916   # Chuck
   1917   "ck": "chuck",
   1918   # Comshare Dimension Definition Language
   1919   "cdl": "cdl",
   1920   # Conary Recipe
   1921   "recipe": "conaryrecipe",
   1922   # Corn config file
   1923   "corn": "corn",
   1924   # ChainPack Object Notation (CPON)
   1925   "cpon": "cpon",
   1926   # Controllable Regex Mutilator
   1927   "crm": "crm",
   1928   # Cyn++
   1929   "cyn": "cynpp",
   1930   # Cypher query language
   1931   "cypher": "cypher",
   1932   # C++
   1933   "cxx": "cpp",
   1934   "c++": "cpp",
   1935   "hh": "cpp",
   1936   "hxx": "cpp",
   1937   "hpp": "cpp",
   1938   "ipp": "cpp",
   1939   "moc": "cpp",
   1940   "tcc": "cpp",
   1941   "inl": "cpp",
   1942   # MS files (ixx: C++ module interface file, Microsoft Project file)
   1943   "ixx": "cpp",
   1944   "mpp": "cpp",
   1945   # C++ 20 modules (clang)
   1946   # https://clang.llvm.org/docs/StandardCPlusPlusModules.html#file-name-requirement
   1947   "cppm": "cpp",
   1948   "ccm": "cpp",
   1949   "cxxm": "cpp",
   1950   "c++m": "cpp",
   1951   # Ch (CHscript)
   1952   "chf": "ch",
   1953   # TLH files are C++ headers generated by Visual C++'s #import from typelibs
   1954   "tlh": "cpp",
   1955   # Cascading Style Sheets
   1956   "css": "css",
   1957   # Common Expression Language (CEL) - https://cel.dev
   1958   "cel": "cel",
   1959   # Century Term Command Scripts (*.cmd too)
   1960   "con": "cterm",
   1961   # ChordPro
   1962   "chopro": "chordpro",
   1963   "crd": "chordpro",
   1964   "cho": "chordpro",
   1965   "crdpro": "chordpro",
   1966   "chordpro": "chordpro",
   1967   # Clean
   1968   "dcl": "clean",
   1969   "icl": "clean",
   1970   # Clever
   1971   "eni": "cl",
   1972   # Clojure
   1973   "clj": "clojure",
   1974   "cljs": "clojure",
   1975   "cljx": "clojure",
   1976   "cljc": "clojure",
   1977   # Cobol
   1978   "cbl": "cobol",
   1979   "cob": "cobol",
   1980   # Coco/R
   1981   "atg": "coco",
   1982   # Citation files
   1983   "cff": "yaml",
   1984   # Cold Fusion
   1985   "cfm": "cf",
   1986   "cfi": "cf",
   1987   "cfc": "cf",
   1988   # Cooklang
   1989   "cook": "cook",
   1990   # Clinical Quality Language (CQL)
   1991   # .cql is also mentioned as the 'XDCC Catcher queue list' file extension.
   1992   # If support for XDCC Catcher is needed in the future, the contents of the file
   1993   # needs to be inspected.
   1994   "cql": "cqlang",
   1995   # Crystal
   1996   "cr": "crystal",
   1997   # CSV Files
   1998   "csv": "csv",
   1999   # Concertor
   2000   "cto": "concerto",
   2001   # CUDA Compute Unified Device Architecture
   2002   "cu": "cuda",
   2003   "cuh": "cuda",
   2004   # HIP Heterogeneous-compute Interface for Portability
   2005   "hip": "hip",
   2006   # Cue
   2007   "cue": "cue",
   2008   # DAX
   2009   "dax": "dax",
   2010   # WildPackets EtherPeek Decoder
   2011   "dcd": "dcd",
   2012   # Elvish
   2013   "elv": "elvish",
   2014   # Faust
   2015   "lib": "faust",
   2016   # Fennel
   2017   "fnl": "fennel",
   2018   "fnlm": "fennel",
   2019   # Libreoffice config files
   2020   "xcu": "xml",
   2021   "xlb": "xml",
   2022   "xlc": "xml",
   2023   "xba": "xml",
   2024   # Libtool files
   2025   "lo": "sh",
   2026   "la": "sh",
   2027   "lai": "sh",
   2028   # LyRiCs
   2029   "lrc": "lyrics",
   2030   # MLIR
   2031   "mlir": "mlir",
   2032   # Quake C
   2033   "qc": "c",
   2034   # Cucumber
   2035   "feature": "cucumber",
   2036   # Communicating Sequential Processes
   2037   "csp": "csp",
   2038   "fdr": "csp",
   2039   # CUPL logic description and simulation
   2040   "pld": "cupl",
   2041   "si": "cuplsim",
   2042   # Dafny
   2043   "dfy": "dafny",
   2044   # Dart
   2045   "dart": "dart",
   2046   "drt": "dart",
   2047   # Dhall
   2048   "dhall": "dhall",
   2049   # ROCKLinux package description
   2050   "desc": "desc",
   2051   # Desktop files
   2052   "desktop": "desktop",
   2053   "directory": "desktop",
   2054   # Diff files
   2055   "diff": "diff",
   2056   "rej": "diff",
   2057   # Djot
   2058   "dj": "djot",
   2059   "djot": "djot",
   2060   # DOT
   2061   "dot": "dot",
   2062   "gv": "dot",
   2063   # Dylan - lid files
   2064   "lid": "dylanlid",
   2065   # Dylan - intr files (melange)
   2066   "intr": "dylanintr",
   2067   # Dylan
   2068   "dylan": "dylan",
   2069   # Dracula
   2070   "drac": "dracula",
   2071   "drc": "dracula",
   2072   "lvs": "dracula",
   2073   "lpe": "dracula",
   2074   # Datascript
   2075   "ds": "datascript",
   2076   # DTD (Document Type Definition for XML)
   2077   "dtd": "dtd",
   2078   # Devicetree (.its for U-Boot Flattened Image Trees, .keymap for ZMK keymap, and
   2079   # .overlay for Zephyr overlay)
   2080   "dts": "dts",
   2081   "dtsi": "dts",
   2082   "dtso": "dts",
   2083   "its": "dts",
   2084   "keymap": "dts",
   2085   "overlay": "dts",
   2086   # Embedix Component Description
   2087   "ecd": "ecd",
   2088   # ed(1)
   2089   "ed": "ed",
   2090   # ERicsson LANGuage; Yaws is erlang too
   2091   "erl": "erlang",
   2092   "hrl": "erlang",
   2093   "yaws": "erlang",
   2094   # Elm
   2095   "elm": "elm",
   2096   # Elsa - https://github.com/ucsd-progsys/elsa
   2097   "lc": "elsa",
   2098   # EdgeDB Schema Definition Language
   2099   "esdl": "esdl",
   2100   # ESQL-C
   2101   "ec": "esqlc",
   2102   "EC": "esqlc",
   2103   # Esterel
   2104   "strl": "esterel",
   2105   # Essbase script
   2106   "csc": "csc",
   2107   # Expect
   2108   "exp": "expect",
   2109   # Falcon
   2110   "fal": "falcon",
   2111   # Fantom
   2112   "fan": "fan",
   2113   "fwt": "fan",
   2114   # Factor
   2115   "factor": "factor",
   2116   # FGA
   2117   "fga": "fga",
   2118   # FIRRTL - Flexible Internal Representation for RTL
   2119   "fir": "firrtl",
   2120   # Fish shell
   2121   "fish": "fish",
   2122   # Flix
   2123   "flix": "flix",
   2124   # Fluent
   2125   "ftl": "fluent",
   2126   # Focus Executable
   2127   "fex": "focexec",
   2128   "focexec": "focexec",
   2129   # Focus Master file (but not for auto.master)
   2130   "mas": "master",
   2131   "master": "master",
   2132   # Forth
   2133   "ft": "forth",
   2134   "fth": "forth",
   2135   "4th": "forth",
   2136   # Reva Forth
   2137   "frt": "reva",
   2138   # Framescript
   2139   "fsl": "framescript",
   2140   # Func
   2141   "fc": "func",
   2142   # Fusion
   2143   "fusion": "fusion",
   2144   # FHIR Shorthand (FSH)
   2145   "fsh": "fsh",
   2146   # F#
   2147   "fsi": "fsharp",
   2148   "fsx": "fsharp",
   2149   # GDMO
   2150   "mo": "gdmo",
   2151   "gdmo": "gdmo",
   2152   # GDscript
   2153   "gd": "gdscript",
   2154   # Godot resource
   2155   "tscn": "gdresource",
   2156   "tres": "gdresource",
   2157   # Godot shader
   2158   "gdshader": "gdshader",
   2159   "shader": "gdshader",
   2160   # Gemtext
   2161   "gmi": "gemtext",
   2162   "gemini": "gemtext",
   2163   # Gift (Moodle)
   2164   "gift": "gift",
   2165   # Gleam
   2166   "gleam": "gleam",
   2167   # GLSL
   2168   # Extensions supported by Khronos reference compiler (with one exception, ".glsl")
   2169   # https://github.com/KhronosGroup/glslang
   2170   "vert": "glsl",
   2171   "tesc": "glsl",
   2172   "tese": "glsl",
   2173   "glsl": "glsl",
   2174   "geom": "glsl",
   2175   "frag": "glsl",
   2176   "comp": "glsl",
   2177   "rgen": "glsl",
   2178   "rmiss": "glsl",
   2179   "rchit": "glsl",
   2180   "rahit": "glsl",
   2181   "rint": "glsl",
   2182   "rcall": "glsl",
   2183   # GN (generate ninja) files
   2184   "gn": "gn",
   2185   "gni": "gn",
   2186   # Glimmer-flavored TypeScript and JavaScript
   2187   "gts": "typescript.glimmer",
   2188   "gjs": "javascript.glimmer",
   2189   # Go (Google)
   2190   "go": "go",
   2191   # GrADS scripts
   2192   "gs": "grads",
   2193   # GraphQL
   2194   "graphql": "graphql",
   2195   "graphqls": "graphql",
   2196   "gql": "graphql",
   2197   # Gretl
   2198   "gretl": "gretl",
   2199   # GNU Server Pages
   2200   "gsp": "gsp",
   2201   # GYP
   2202   "gyp": "gyp",
   2203   "gypi": "gyp",
   2204   # Hack
   2205   "hack": "hack",
   2206   "hackpartial": "hack",
   2207   # Haml
   2208   "haml": "haml",
   2209   # Hamster Classic | Playground files
   2210   "hsm": "hamster",
   2211   # Handlebars
   2212   "hbs": "handlebars",
   2213   # Hare
   2214   "ha": "hare",
   2215   # HLSL
   2216   "hlsl": "hlsl",
   2217   # Haskell
   2218   "hs": "haskell",
   2219   "hsc": "haskell",
   2220   "hs-boot": "haskell",
   2221   "hsig": "haskell",
   2222   "lhs": "lhaskell",
   2223   "chs": "chaskell",
   2224   # Haste
   2225   "ht": "haste",
   2226   "htpp": "hastepreproc",
   2227   # Haxe
   2228   "hx": "haxe",
   2229   # HCL
   2230   "hcl": "hcl",
   2231   # Hercules
   2232   "vc": "hercules",
   2233   "ev": "hercules",
   2234   "sum": "hercules",
   2235   "errsum": "hercules",
   2236   # HEEx
   2237   "heex": "heex",
   2238   # HEX (Intel)
   2239   "hex": "hex",
   2240   "ihex": "hex",
   2241   "int": "hex",
   2242   "ihe": "hex",
   2243   "ihx": "hex",
   2244   "mcs": "hex",
   2245   "h32": "hex",
   2246   "h80": "hex",
   2247   "h86": "hex",
   2248   "a43": "hex",
   2249   "a90": "hex",
   2250   # Hjson
   2251   "hjson": "hjson",
   2252   # HLS Playlist (or another form of playlist)
   2253   "m3u": "hlsplaylist",
   2254   "m3u8": "hlsplaylist",
   2255   # Hollywood
   2256   "hws": "hollywood",
   2257   # Hoon
   2258   "hoon": "hoon",
   2259   # TI Code Composer Studio General Extension Language
   2260   "gel": "gel",
   2261   # HTTP request files
   2262   "http": "http",
   2263   # HTML with Ruby - eRuby
   2264   "erb": "eruby",
   2265   "rhtml": "eruby",
   2266   # Some template.  Used to be HTML Cheetah.
   2267   "tmpl": "template",
   2268   # Hurl
   2269   "hurl": "hurl",
   2270   # Hylo
   2271   "hylo": "hylo",
   2272   # Hyper Builder
   2273   "hb": "hb",
   2274   # Httest
   2275   "htt": "httest",
   2276   "htb": "httest",
   2277   # ICalendar
   2278   "ics": "icalendar",
   2279   # Icon
   2280   "icn": "icon",
   2281   # Microsoft IDL (Interface Description Language)  Also *.idl
   2282   # MOF = WMI (Windows Management Instrumentation) Managed Object Format
   2283   "odl": "msidl",
   2284   "mof": "msidl",
   2285   # Idris2
   2286   "idr": "idris2",
   2287   "lidr": "lidris2",
   2288   # Inform
   2289   "inf": "inform",
   2290   "INF": "inform",
   2291   # Ipkg for Idris 2 language
   2292   "ipkg": "ipkg",
   2293   # Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
   2294   "4gl": "fgl",
   2295   "4gh": "fgl",
   2296   "m4gl": "fgl",
   2297   # .INI file for MSDOS
   2298   "ini": "dosini",
   2299   "INI": "dosini",
   2300   # Inko
   2301   "inko": "inko",
   2302   # Inno Setup
   2303   "iss": "iss",
   2304   # J
   2305   "ijs": "j",
   2306   # JAL
   2307   "jal": "jal",
   2308   "JAL": "jal",
   2309   # Jam
   2310   "jpl": "jam",
   2311   "jpr": "jam",
   2312   # Janet
   2313   "janet": "janet",
   2314   # Java
   2315   "java": "java",
   2316   "jav": "java",
   2317   "jsh": "java",
   2318   # JavaCC
   2319   "jj": "javacc",
   2320   "jjt": "javacc",
   2321   # JavaScript, ECMAScript, ES module script, CommonJS script
   2322   "js": "javascript",
   2323   "jsm": "javascript",
   2324   "javascript": "javascript",
   2325   "es": "javascript",
   2326   "mjs": "javascript",
   2327   "cjs": "javascript",
   2328   # JavaScript with React
   2329   "jsx": "javascriptreact",
   2330   # Java Server Pages
   2331   "jsp": "jsp",
   2332   # Jess
   2333   "clp": "jess",
   2334   # Jgraph
   2335   "jgr": "jgraph",
   2336   # Jinja
   2337   "jinja": "jinja",
   2338   # Jujutsu
   2339   "jjdescription": "jjdescription",
   2340   # Jovial
   2341   "jov": "jovial",
   2342   "j73": "jovial",
   2343   "jovial": "jovial",
   2344   # Jq
   2345   "jq": "jq",
   2346   # JSON5
   2347   "json5": "json5",
   2348   # JSON Patch (RFC 6902)
   2349   "json-patch": "json",
   2350   # Geojson is also json
   2351   "geojson": "json",
   2352   # Jupyter Notebook and jupyterlab config is also json
   2353   "ipynb": "json",
   2354   "jupyterlab-settings": "json",
   2355   # Sublime config
   2356   "sublime-project": "json",
   2357   "sublime-settings": "json",
   2358   "sublime-workspace": "json",
   2359   # JSON
   2360   "json": "json",
   2361   "jsonp": "json",
   2362   "webmanifest": "json",
   2363   # JSON Lines
   2364   "jsonl": "jsonl",
   2365   # JSON-LD
   2366   "jsonld": "jsonld",
   2367   # Jsonnet
   2368   "jsonnet": "jsonnet",
   2369   "libsonnet": "jsonnet",
   2370   # Julia
   2371   "jl": "julia",
   2372   # KAREL
   2373   "kl": "karel",
   2374   "KL": "karel",
   2375   # Kawasaki AS
   2376   "pg": "kawasaki_as",
   2377   # KDL
   2378   "kdl": "kdl",
   2379   # KerML
   2380   "kerml": "kerml",
   2381   # Kixtart
   2382   "kix": "kix",
   2383   # Kimwitu[++]
   2384   "k": "kwt",
   2385   # Kivy
   2386   "kv": "kivy",
   2387   # Koka
   2388   "kk": "koka",
   2389   # Kos
   2390   "kos": "kos",
   2391   # Kotlin
   2392   "kt": "kotlin",
   2393   "ktm": "kotlin",
   2394   "kts": "kotlin",
   2395   # KDE script
   2396   "ks": "kscript",
   2397   # Kaitai struct
   2398   "ksy": "yaml",
   2399   # Kyaml
   2400   "kyaml": "yaml",
   2401   "kyml": "yaml",
   2402   # Lace (ISE)
   2403   "ace": "lace",
   2404   "ACE": "lace",
   2405   # Latte
   2406   "latte": "latte",
   2407   "lte": "latte",
   2408   # LDAP LDIF
   2409   "ldif": "ldif",
   2410   # Lean
   2411   "lean": "lean",
   2412   # Ledger
   2413   "ldg": "ledger",
   2414   "ledger": "ledger",
   2415   "journal": "ledger",
   2416   # Leex
   2417   "xrl": "leex",
   2418   # Leo
   2419   "leo": "leo",
   2420   # Less
   2421   "less": "less",
   2422   # Lex
   2423   "lex": "lex",
   2424   "l": "lex",
   2425   "lxx": "lex",
   2426   "l++": "lex",
   2427   # Lilypond
   2428   "ly": "lilypond",
   2429   "ily": "lilypond",
   2430   # Liquidsoap
   2431   "liq": "liquidsoap",
   2432   # Liquid
   2433   "liquid": "liquid",
   2434   # Lite
   2435   "lite": "lite",
   2436   "lt": "lite",
   2437   # Livebook
   2438   "livemd": "livebook",
   2439   # Logtalk
   2440   "lgt": "logtalk",
   2441   # LOTOS
   2442   "lotos": "lotos",
   2443   # Lout (also: *.lt)
   2444   "lou": "lout",
   2445   "lout": "lout",
   2446   # Luau
   2447   "luau": "luau",
   2448   # Lynx style file (or LotusScript!)
   2449   "lss": "lss",
   2450   # MaGic Point
   2451   "mgp": "mgp",
   2452   # MakeIndex
   2453   "ist": "ist",
   2454   "mst": "ist",
   2455   # Mallard
   2456   "page": "mallard",
   2457   # Manpage
   2458   "man": "man",
   2459   # Marko
   2460   "marko": "marko",
   2461   # Maple V
   2462   "mv": "maple",
   2463   "mpl": "maple",
   2464   "mws": "maple",
   2465   # Mason (it used to include *.comp, are those Mason files?)
   2466   "mason": "mason",
   2467   "mhtml": "mason",
   2468   # Mathematica notebook and package files
   2469   "nb": "mma",
   2470   "wl": "mma",
   2471   # Maya Extension Language
   2472   "mel": "mel",
   2473   # mcmeta
   2474   "mcmeta": "json",
   2475   # MediaWiki
   2476   "mw": "mediawiki",
   2477   "wiki": "mediawiki",
   2478   # Mermaid
   2479   "mmd": "mermaid",
   2480   "mmdc": "mermaid",
   2481   "mermaid": "mermaid",
   2482   # Meson Build system config
   2483   "wrap": "dosini",
   2484   # Metafont
   2485   "mf": "mf",
   2486   # MetaPost
   2487   "mp": "mp",
   2488   # MGL
   2489   "mgl": "mgl",
   2490   # MIX - Knuth assembly
   2491   "mix": "mix",
   2492   "mixal": "mix",
   2493   # Symbian meta-makefile definition (MMP)
   2494   "mmp": "mmp",
   2495   # Larch/Modula-3
   2496   "lm3": "modula3",
   2497   # Monk
   2498   "isc": "monk",
   2499   "monk": "monk",
   2500   "ssc": "monk",
   2501   "tsc": "monk",
   2502   # MOO
   2503   "moo": "moo",
   2504   # Moonscript
   2505   "moon": "moonscript",
   2506   # Move language
   2507   "move": "move",
   2508   # MPD is based on XML
   2509   "mpd": "xml",
   2510   # Motorola S record
   2511   "s19": "srec",
   2512   "s28": "srec",
   2513   "s37": "srec",
   2514   "mot": "srec",
   2515   "srec": "srec",
   2516   # Msql
   2517   "msql": "msql",
   2518   # MuPAD source
   2519   "mu": "mupad",
   2520   # Mush
   2521   "mush": "mush",
   2522   # Mustache
   2523   "mustache": "mustache",
   2524   # N1QL
   2525   "n1ql": "n1ql",
   2526   "nql": "n1ql",
   2527   # Neon
   2528   "neon": "neon",
   2529   # NetLinx
   2530   "axs": "netlinx",
   2531   "axi": "netlinx",
   2532   # Nickel
   2533   "ncl": "nickel",
   2534   # Nim file
   2535   "nim": "nim",
   2536   "nims": "nim",
   2537   "nimble": "nim",
   2538   # Ninja file
   2539   "ninja": "ninja",
   2540   # Nix
   2541   "nix": "nix",
   2542   # Norg
   2543   "norg": "norg",
   2544   # Novell netware batch files
   2545   "ncf": "ncf",
   2546   # N-Quads
   2547   "nq": "nq",
   2548   # Not Quite C
   2549   "nqc": "nqc",
   2550   # NSE - Nmap Script Engine - uses Lua syntax
   2551   "nse": "lua",
   2552   # NSIS
   2553   "nsi": "nsis",
   2554   "nsh": "nsis",
   2555   # N-Triples
   2556   "nt": "ntriples",
   2557   # Nu
   2558   "nu": "nu",
   2559   # Numbat
   2560   "nbt": "numbat",
   2561   # Oblivion Language and Oblivion Script Extender
   2562   "obl": "obse",
   2563   "obse": "obse",
   2564   "oblivion": "obse",
   2565   "obscript": "obse",
   2566   # Objdump
   2567   "objdump": "objdump",
   2568   "cppobjdump": "objdump",
   2569   # Occam
   2570   "occ": "occam",
   2571   # Odin
   2572   "odin": "odin",
   2573   # Omnimark
   2574   "xom": "omnimark",
   2575   "xin": "omnimark",
   2576   # OpenROAD
   2577   "or": "openroad",
   2578   # OpenSCAD
   2579   "scad": "openscad",
   2580   # Oracle config file
   2581   "ora": "ora",
   2582   # Org (Emacs' org-mode)
   2583   "org": "org",
   2584   "org_archive": "org",
   2585   # PApp
   2586   "papp": "papp",
   2587   "pxml": "papp",
   2588   "pxsl": "papp",
   2589   # Pascal (also *.p, *.pp, *.inc)
   2590   "pas": "pascal",
   2591   # Delphi
   2592   "dpr": "pascal",
   2593   # Free Pascal makefile definition file
   2594   "fpc": "fpcmake",
   2595   # Path of Exile item filter
   2596   "filter": "poefilter",
   2597   # PDF
   2598   "pdf": "pdf",
   2599   # PCMK - HAE - crm configure edit
   2600   "pcmk": "pcmk",
   2601   # PEM (Privacy-Enhanced Mail)
   2602   "pem": "pem",
   2603   "cer": "pem",
   2604   "crt": "pem",
   2605   "csr": "pem",
   2606   # Perl POD
   2607   "pod": "pod",
   2608   # Pike and Cmod
   2609   "pike": "pike",
   2610   "pmod": "pike",
   2611   "cmod": "cmod",
   2612   # Palm Resource compiler
   2613   "rcp": "pilrc",
   2614   # Pip requirements
   2615   "pip": "requirements",
   2616   # PL/1, PL/I
   2617   "pli": "pli",
   2618   "pl1": "pli",
   2619   # PL/M (also: *.inp)
   2620   "plm": "plm",
   2621   "p36": "plm",
   2622   "pac": "plm",
   2623   # PL/SQL
   2624   "pls": "plsql",
   2625   "plsql": "plsql",
   2626   # PLP
   2627   "plp": "plp",
   2628   # PO and PO template (GNU gettext)
   2629   "po": "po",
   2630   "pot": "po",
   2631   # Pony
   2632   "pony": "pony",
   2633   # PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
   2634   "ps": "postscr",
   2635   "pfa": "postscr",
   2636   "afm": "postscr",
   2637   "eps": "postscr",
   2638   "epsf": "postscr",
   2639   "epsi": "postscr",
   2640   "ai": "postscr",
   2641   # PostScript Printer Description
   2642   "ppd": "ppd",
   2643   # Povray
   2644   "pov": "pov",
   2645   # Power Query M
   2646   "pq": "pq",
   2647   # Prisma
   2648   "prisma": "prisma",
   2649   # PPWizard
   2650   "it": "ppwiz",
   2651   "ih": "ppwiz",
   2652   # Pug
   2653   "pug": "pug",
   2654   # Embedded Puppet
   2655   "epp": "epuppet",
   2656   # Obj 3D file format
   2657   # TODO: is there a way to avoid MS-Windows Object files?
   2658   "obj": "obj",
   2659   # Oracle Pro*C/C++
   2660   "pc": "proc",
   2661   # Privoxy actions file
   2662   "action": "privoxy",
   2663   # Software Distributor Product Specification File (POSIX 1387.2-1995)
   2664   "psf": "psf",
   2665   # Prolog
   2666   "pdb": "prolog",
   2667   # Promela
   2668   "pml": "promela",
   2669   # Property Specification Language (PSL)
   2670   "psl": "psl",
   2671   # Google protocol buffers
   2672   "proto": "proto",
   2673   "txtpb": "pbtxt",
   2674   "textproto": "pbtxt",
   2675   "textpb": "pbtxt",
   2676   "pbtxt": "pbtxt",
   2677   "aconfig": "pbtxt", # Android aconfig files
   2678   # Poke
   2679   "pk": "poke",
   2680   # Nvidia PTX (Parallel Thread Execution)
   2681   # See https://docs.nvidia.com/cuda/parallel-thread-execution/
   2682   "ptx": "ptx",
   2683   # Purescript
   2684   "purs": "purescript",
   2685   # Pyret
   2686   "arr": "pyret",
   2687   # Pyrex/Cython
   2688   "pyx": "pyrex",
   2689   "pyx+": "pyrex",
   2690   "pxd": "pyrex",
   2691   "pxi": "pyrex",
   2692   # QL
   2693   "ql": "ql",
   2694   "qll": "ql",
   2695   # QML
   2696   "qml": "qml",
   2697   "qbs": "qml",
   2698   # Quarto
   2699   "qmd": "quarto",
   2700   # QuickBms
   2701   "bms": "quickbms",
   2702   # Popcap Reanimation files
   2703   "reanim": "xml",
   2704   # Racket (formerly detected as "scheme")
   2705   "rkt": "racket",
   2706   "rktd": "racket",
   2707   "rktl": "racket",
   2708   # Radiance
   2709   "rad": "radiance",
   2710   "mat": "radiance",
   2711   # Raku (formerly Perl6)
   2712   "pm6": "raku",
   2713   "p6": "raku",
   2714   "t6": "raku",
   2715   "pod6": "raku",
   2716   "raku": "raku",
   2717   "rakumod": "raku",
   2718   "rakudoc": "raku",
   2719   "rakutest": "raku",
   2720   # Razor
   2721   "cshtml": "razor",
   2722   "razor": "razor",
   2723   # Renderman Interface Bytestream
   2724   "rib": "rib",
   2725   # Rego Policy Language
   2726   "rego": "rego",
   2727   # Rexx
   2728   "rex": "rexx",
   2729   "orx": "rexx",
   2730   "rxo": "rexx",
   2731   "rxj": "rexx",
   2732   "jrexx": "rexx",
   2733   "rexxj": "rexx",
   2734   "rexx": "rexx",
   2735   "testGroup": "rexx",
   2736   "testUnit": "rexx",
   2737   # RSS looks like XML
   2738   "rss": "xml",
   2739   # ReScript
   2740   "res": "rescript",
   2741   "resi": "rescript",
   2742   # Relax NG Compact
   2743   "rnc": "rnc",
   2744   # Relax NG XML
   2745   "rng": "rng",
   2746   # ILE RPG
   2747   "rpgle": "rpgle",
   2748   "rpgleinc": "rpgle",
   2749   # RPL/2
   2750   "rpl": "rpl",
   2751   # Robot Framework
   2752   "robot": "robot",
   2753   "resource": "robot",
   2754   # Roc
   2755   "roc": "roc",
   2756   # RON (Rusty Object Notation)
   2757   "ron": "ron",
   2758   # MikroTik RouterOS script
   2759   "rsc": "routeros",
   2760   # Rpcgen
   2761   "x": "rpcgen",
   2762   # reStructuredText Documentation Format
   2763   "rst": "rst",
   2764   # RTF
   2765   "rtf": "rtf",
   2766   # ObjectScript Routine
   2767   "rtn": "objectscript_routine",
   2768   # Ruby
   2769   "rb": "ruby",
   2770   "rbw": "ruby",
   2771   # RubyGems
   2772   "gemspec": "ruby",
   2773   # RBS (Ruby Signature)
   2774   "rbs": "rbs",
   2775   # Rackup
   2776   "ru": "ruby",
   2777   # Ruby on Rails
   2778   "builder": "ruby",
   2779   "rxml": "ruby",
   2780   "rjs": "ruby",
   2781   # Sorbet (Ruby typechecker)
   2782   "rbi": "ruby",
   2783   # Rust
   2784   "rs": "rust",
   2785   # S-lang
   2786   "sl": "slang",
   2787   # Sage
   2788   "sage": "sage",
   2789   # SAS script
   2790   "sas": "sas",
   2791   # Sass
   2792   "sass": "sass",
   2793   # Scala
   2794   "scala": "scala",
   2795   "mill": "scala",
   2796   # SBT - Scala Build Tool
   2797   "sbt": "sbt",
   2798   # SGF, Smart Game Format
   2799   "sgf": "sgf",
   2800   # Slang Shading Language
   2801   "slang": "shaderslang",
   2802   # Slint
   2803   "slint": "slint",
   2804   # Scilab
   2805   "sci": "scilab",
   2806   "sce": "scilab",
   2807   # SCSS
   2808   "scss": "scss",
   2809   # SD: Streaming Descriptors
   2810   "sd": "sd",
   2811   # SDL
   2812   "sdl": "sdl",
   2813   "pr": "sdl",
   2814   # sed
   2815   "sed": "sed",
   2816   # SubRip
   2817   "srt": "srt",
   2818   # SubStation Alpha
   2819   "ass": "ssa",
   2820   "ssa": "ssa",
   2821   # svelte
   2822   "svelte": "svelte",
   2823   # Sieve (RFC 3028, 5228)
   2824   "siv": "sieve",
   2825   "sieve": "sieve",
   2826   # TriG
   2827   "trig": "trig",
   2828   # Tolk
   2829   "tolk": "tolk",
   2830   # Zig and Zig Object Notation (ZON)
   2831   "zig": "zig",
   2832   "zon": "zig",
   2833   # Ziggy and Ziggy Schema
   2834   "ziggy": "ziggy",
   2835   "ziggy-schema": "ziggy_schema",
   2836   # Zserio
   2837   "zs": "zserio",
   2838   # Salt state files
   2839   "sls": "salt",
   2840   # Sexplib
   2841   "sexp": "sexplib",
   2842   # Simula
   2843   "sim": "simula",
   2844   # SINDA
   2845   "sin": "sinda",
   2846   "s85": "sinda",
   2847   # SiSU
   2848   "sst": "sisu",
   2849   "ssm": "sisu",
   2850   "ssi": "sisu",
   2851   "-sst": "sisu",
   2852   "_sst": "sisu",
   2853   # SKILL
   2854   "il": "skill",
   2855   "ils": "skill",
   2856   "cdf": "skill",
   2857   # Cadence
   2858   "cdc": "cdc",
   2859   # Cangjie
   2860   "cj": "cangjie",
   2861   # SLRN
   2862   "score": "slrnsc",
   2863   # Smali
   2864   "smali": "smali",
   2865   # Smalltalk
   2866   "st": "st",
   2867   # Smarty templates
   2868   "tpl": "smarty",
   2869   # SMITH
   2870   "smt": "smith",
   2871   "smith": "smith",
   2872   # Smithy
   2873   "smithy": "smithy",
   2874   # Snobol4 and spitbol
   2875   "sno": "snobol4",
   2876   "spt": "snobol4",
   2877   # SNMP MIB files
   2878   "mib": "mib",
   2879   "my": "mib",
   2880   # Solidity
   2881   "sol": "solidity",
   2882   # SPARQL queries
   2883   "rq": "sparql",
   2884   "sparql": "sparql",
   2885   # Spec (Linux RPM)
   2886   "spec": "spec",
   2887   # Speedup (AspenTech plant simulator)
   2888   "speedup": "spup",
   2889   "spdata": "spup",
   2890   "spd": "spup",
   2891   # Slice
   2892   "ice": "slice",
   2893   # Microsoft Visual Studio Solution
   2894   "sln": "solution",
   2895   "slnf": "json",
   2896   "slnx": "xml",
   2897   # Spice
   2898   "sp": "spice",
   2899   "spice": "spice",
   2900   # Spyce
   2901   "spy": "spyce",
   2902   "spi": "spyce",
   2903   # SQL for Oracle Designer
   2904   "tyb": "sql",
   2905   "tyc": "sql",
   2906   "pkb": "sql",
   2907   "pks": "sql",
   2908   # SQLJ
   2909   "sqlj": "sqlj",
   2910   # PRQL
   2911   "prql": "prql",
   2912   # SQR
   2913   "sqr": "sqr",
   2914   "sqi": "sqr",
   2915   # Squirrel
   2916   "nut": "squirrel",
   2917   # Starlark
   2918   "ipd": "starlark",
   2919   "sky": "starlark",
   2920   "star": "starlark",
   2921   "starlark": "starlark",
   2922   # OpenVPN configuration
   2923   "ovpn": "openvpn",
   2924   # Stata
   2925   "ado": "stata",
   2926   "do": "stata",
   2927   "imata": "stata",
   2928   "mata": "stata",
   2929   # SMCL
   2930   "hlp": "smcl",
   2931   "ihlp": "smcl",
   2932   "smcl": "smcl",
   2933   # Soy
   2934   "soy": "soy",
   2935   # Stored Procedures
   2936   "stp": "stp",
   2937   # Standard ML
   2938   "sml": "sml",
   2939   # Sratus VOS command macro
   2940   "cm": "voscm",
   2941   # Sway (programming language)
   2942   "sw": "sway",
   2943   # Swift
   2944   "swift": "swift",
   2945   "swiftinterface": "swift",
   2946   # Swig
   2947   "swg": "swig",
   2948   "swig": "swig",
   2949   # Synopsys Design Constraints
   2950   "sdc": "sdc",
   2951   # SVG (Scalable Vector Graphics)
   2952   "svg": "svg",
   2953   # Surface
   2954   "sface": "surface",
   2955   # SysML
   2956   "sysml": "sysml",
   2957   # LLVM TableGen
   2958   "td": "tablegen",
   2959   # TAK
   2960   "tak": "tak",
   2961   # Unx Tal
   2962   "tal": "tal",
   2963   # templ
   2964   "templ": "templ",
   2965   # Teal
   2966   "tl": "teal",
   2967   # TealInfo
   2968   "tli": "tli",
   2969   # Telix Salt
   2970   "slt": "tsalt",
   2971   # Terminfo
   2972   "ti": "terminfo",
   2973   # Tera
   2974   "tera": "tera",
   2975   # Terraform variables
   2976   "tfvars": "terraform-vars",
   2977   # TeX
   2978   "latex": "tex",
   2979   "sty": "tex",
   2980   "dtx": "tex",
   2981   "ltx": "tex",
   2982   "bbl": "tex",
   2983   # LaTeX files generated by Inkscape
   2984   "pdf_tex": "tex",
   2985   # ConTeXt
   2986   "mkii": "context",
   2987   "mkiv": "context",
   2988   "mkvi": "context",
   2989   "mkxl": "context",
   2990   "mklx": "context",
   2991   # Texinfo
   2992   "texinfo": "texinfo",
   2993   "texi": "texinfo",
   2994   "txi": "texinfo",
   2995   # Thrift (Apache)
   2996   "thrift": "thrift",
   2997   # Tiger
   2998   "tig": "tiger",
   2999   # TLA+
   3000   "tla": "tla",
   3001   # TPP - Text Presentation Program
   3002   "tpp": "tpp",
   3003   # TRACE32 Script Language
   3004   "cmm": "trace32",
   3005   "cmmt": "trace32",
   3006   "t32": "trace32",
   3007   # Treetop
   3008   "treetop": "treetop",
   3009   # TSS - Geometry
   3010   "tssgm": "tssgm",
   3011   # TSS - Optics
   3012   "tssop": "tssop",
   3013   # TSS - Command Line (temporary)
   3014   "tsscl": "tsscl",
   3015   # TSV Files
   3016   "tsv": "tsv",
   3017   # Tutor mode
   3018   "tutor": "tutor",
   3019   # TWIG files
   3020   "twig": "twig",
   3021   # TypeScript module and common
   3022   "mts": "typescript",
   3023   "cts": "typescript",
   3024   # TypeScript with React
   3025   "tsx": "typescriptreact",
   3026   # TypeSpec files
   3027   "tsp": "typespec",
   3028   # Motif UIT/UIL files
   3029   "uit": "uil",
   3030   "uil": "uil",
   3031   # Ungrammar, AKA Un-grammar
   3032   "ungram": "ungrammar",
   3033   # UnrealScript
   3034   "uc": "uc",
   3035   # URL shortcut
   3036   "url": "urlshortcut",
   3037   # V
   3038   "vsh": "v",
   3039   "vv": "v",
   3040   # Vala
   3041   "vala": "vala",
   3042   # VDF
   3043   "vdf": "vdf",
   3044   # VDM
   3045   "vdmpp": "vdmpp",
   3046   "vpp": "vdmpp",
   3047   "vdmrt": "vdmrt",
   3048   "vdmsl": "vdmsl",
   3049   "vdm": "vdmsl",
   3050   # Vento
   3051   "vto": "vento",
   3052   # Vera
   3053   "vr": "vera",
   3054   "vri": "vera",
   3055   "vrh": "vera",
   3056   # Verilog-AMS HDL
   3057   "va": "verilogams",
   3058   "vams": "verilogams",
   3059   # SystemVerilog
   3060   "sv": "systemverilog",
   3061   "svh": "systemverilog",
   3062   # VHS tape
   3063   # .tape is also used by TapeCalc, which we do not support ATM.  If TapeCalc
   3064   # support is needed the contents of the file needs to be inspected.
   3065   "tape": "vhs",
   3066   # VHDL
   3067   "hdl": "vhdl",
   3068   "vhd": "vhdl",
   3069   "vhdl": "vhdl",
   3070   "vbe": "vhdl",
   3071   "vst": "vhdl",
   3072   "vho": "vhdl",
   3073   # Visual Basic
   3074   # user control, ActiveX document form, active designer, property page
   3075   "ctl": "vb",
   3076   "dob": "vb",
   3077   "dsr": "vb",
   3078   "pag": "vb",
   3079   # Visual Basic Project
   3080   "vbp": "dosini",
   3081   # VBScript (close to Visual Basic)
   3082   "vbs": "vb",
   3083   # Visual Basic .NET (close to Visual Basic)
   3084   "vb": "vb",
   3085   # Visual Studio Macro
   3086   "dsm": "vb",
   3087   # SaxBasic (close to Visual Basic)
   3088   "sba": "vb",
   3089   # VRML V1.0c
   3090   "wrl": "vrml",
   3091   # Vroom (vim testing and executable documentation)
   3092   "vroom": "vroom",
   3093   # Vue.js Single File Component
   3094   "vue": "vue",
   3095   # WebAssembly
   3096   "wat": "wat",
   3097   "wast": "wat",
   3098   # WebAssembly Interface Type (WIT)
   3099   "wit": "wit",
   3100   # Webmacro
   3101   "wm": "webmacro",
   3102   # WebGPU Shading Language (WGSL)
   3103   "wgsl": "wgsl",
   3104   # Website MetaLanguage
   3105   "wml": "wml",
   3106   # Winbatch
   3107   "wbt": "winbatch",
   3108   # WSML
   3109   "wsml": "wsml",
   3110   # WPL
   3111   "wpl": "xml",
   3112   # XHTML
   3113   "xhtml": "xhtml",
   3114   "xht": "xhtml",
   3115   # Xilinx Vivado/Vitis project files and block design files
   3116   "xpr": "xml",
   3117   "xpfm": "xml",
   3118   "spfm": "xml",
   3119   "bxml": "xml",
   3120   "mmi": "xml",
   3121   "bd": "json",
   3122   "bda": "json",
   3123   "xci": "json",
   3124   "mss": "mss",
   3125   # XS Perl extension interface language
   3126   "xs": "xs",
   3127   # Xmath
   3128   "msc": "xmath",
   3129   "msf": "xmath",
   3130   # XMI (holding UML models) is also XML
   3131   "xmi": "xml",
   3132   # Unison Language
   3133   "u": "unison",
   3134   "uu": "unison",
   3135   # Qt Linguist translation source and Qt User Interface Files are XML
   3136   # However, for .ts TypeScript is more common.
   3137   "ui": "xml",
   3138   # TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)
   3139   "tpm": "xml",
   3140   # Web Services Description Language (WSDL)
   3141   "wsdl": "xml",
   3142   # Workflow Description Language (WDL)
   3143   "wdl": "wdl",
   3144   # XLIFF (XML Localisation Interchange File Format) is also XML
   3145   "xlf": "xml",
   3146   "xliff": "xml",
   3147   # XML User Interface Language
   3148   "xul": "xml",
   3149   # Xquery
   3150   "xq": "xquery",
   3151   "xql": "xquery",
   3152   "xqm": "xquery",
   3153   "xquery": "xquery",
   3154   "xqy": "xquery",
   3155   # XSD
   3156   "xsd": "xsd",
   3157   # Xslt
   3158   "xsl": "xslt",
   3159   "xslt": "xslt",
   3160   # Yacc
   3161   "yy": "yacc",
   3162   "yxx": "yacc",
   3163   "y++": "yacc",
   3164   # Yaml
   3165   "yaml": "yaml",
   3166   "yml": "yaml",
   3167   "eyaml": "yaml",
   3168   # Raml
   3169   "raml": "raml",
   3170   # YANG
   3171   "yang": "yang",
   3172   # YARA, YARA-X
   3173   "yara": "yara",
   3174   "yar": "yara",
   3175   # Yuck
   3176   "yuck": "yuck",
   3177   # Zimbu
   3178   "zu": "zimbu",
   3179   # Zimbu Templates
   3180   "zut": "zimbutempl",
   3181   # Z80 assembler asz80
   3182   "z8a": "z8a",
   3183   # Stylus
   3184   "styl": "stylus",
   3185   "stylus": "stylus",
   3186   # Universal Scene Description
   3187   "usda": "usd",
   3188   "usd": "usd",
   3189   # Rofi stylesheet
   3190   "rasi": "rasi",
   3191   "rasinc": "rasi",
   3192   # Zsh module
   3193   # mdd: https://github.com/zsh-users/zsh/blob/57248b88830ce56adc243a40c7773fb3825cab34/Etc/zsh-development-guide#L285-L288
   3194   # mdh, pro: https://github.com/zsh-users/zsh/blob/57248b88830ce56adc243a40c7773fb3825cab34/Etc/zsh-development-guide#L268-L271
   3195   # *.mdd will generate *.mdh, *.pro and *.epro.
   3196   # module's *.c will #include *.mdh containing module dependency information and
   3197   # *.pro containing all static declarations of *.c
   3198   # *.epro contains all external declarations of *.c
   3199   "mdh": "c",
   3200   "epro": "c",
   3201   "mdd": "sh",
   3202   # Blueprint markup files
   3203   "blp": "blueprint",
   3204   # Blueprint build system file
   3205   "bp": "bp",
   3206   # Tiltfile
   3207   "Tiltfile": "tiltfile",
   3208   "tiltfile": "tiltfile",
   3209   # Ghostty
   3210   "ghostty": "ghostty",
   3211   # Xilinx Design Constraint file
   3212   "xdc": "tcl",
   3213 }
   3214 # Key: file name (the final path component, excluding the drive and root)
   3215 # Value: filetype
   3216 const ft_from_name = {
   3217   # Ant
   3218   "build.xml": "ant",
   3219   # Ash of busybox
   3220   ".ash_history": "sh",
   3221   # Automake (must be before the *.am pattern)
   3222   "makefile.am": "automake",
   3223   "Makefile.am": "automake",
   3224   "GNUmakefile.am": "automake",
   3225   # APT config file
   3226   "apt.conf": "aptconf",
   3227   # BIND zone
   3228   "named.root": "bindzone",
   3229   # Brewfile (uses Ruby syntax)
   3230   "Brewfile": "ruby",
   3231   # Busted (Lua unit testing framework - configuration files)
   3232   ".busted": "lua",
   3233   # Bun history
   3234   ".bun_repl_history": "javascript",
   3235   # Calendar
   3236   "calendar": "calendar",
   3237   # Cgdb config file
   3238   "cgdbrc": "cgdbrc",
   3239   # Cfengine
   3240   "cfengine.conf": "cfengine",
   3241   # Chktex
   3242   ".chktexrc": "conf",
   3243   # Codeowners
   3244   "CODEOWNERS": "codeowners",
   3245   # Clangd
   3246   ".clangd": "yaml",
   3247   # Conda configuration file
   3248   ".condarc": "yaml",
   3249   "condarc": "yaml",
   3250   # Cling
   3251   ".cling_history": "cpp",
   3252   # CmakeCache
   3253   "CMakeCache.txt": "cmakecache",
   3254   # Configure scripts
   3255   "configure.in": "config",
   3256   "configure.ac": "config",
   3257   # Debian devscripts
   3258   "devscripts.conf": "sh",
   3259   ".devscripts": "sh",
   3260   # Fontconfig config files
   3261   "fonts.conf": "xml",
   3262   # Libreoffice config files
   3263   "psprint.conf": "dosini",
   3264   "sofficerc": "dosini",
   3265   # Lynx config files
   3266   "lynx.cfg": "lynx",
   3267   # Mamba configuration file
   3268   ".mambarc": "yaml",
   3269   "mambarc": "yaml",
   3270   # XDG mimeapps.list
   3271   "mimeapps.list": "dosini",
   3272   # Many tools written in Python use dosini as their config
   3273   # like setuptools, pudb, coverage, pypi, gitlint, oelint-adv, pylint, bpython, mypy
   3274   # (must be before *.cfg)
   3275   "pip.conf": "dosini",
   3276   "setup.cfg": "dosini",
   3277   "pudb.cfg": "dosini",
   3278   ".coveragerc": "dosini",
   3279   ".pypirc": "dosini",
   3280   ".gitlint": "dosini",
   3281   ".oelint.cfg": "dosini",
   3282   # Many tools written in Python use toml as their config, like black
   3283   ".black": "toml",
   3284   # Wakatime config
   3285   ".wakatime.cfg": "dosini",
   3286   # Deno history
   3287   "deno_history.txt": "javascript",
   3288   # Deny hosts
   3289   "denyhosts.conf": "denyhosts",
   3290   # Dict config
   3291   "dict.conf": "dictconf",
   3292   ".dictrc": "dictconf",
   3293   # Earthfile
   3294   "Earthfile": "earthfile",
   3295   # EditorConfig
   3296   ".editorconfig": "editorconfig",
   3297   # Elinks configuration
   3298   "elinks.conf": "elinks",
   3299   # Erlang
   3300   "rebar.config": "erlang",
   3301   # Exim
   3302   "exim.conf": "exim",
   3303   # Exports
   3304   "exports": "exports",
   3305   # Fetchmail RC file
   3306   ".fetchmailrc": "fetchmail",
   3307   # Focus Master file (but not for auto.master)
   3308   "auto.master": "conf",
   3309   # FStab
   3310   "fstab": "fstab",
   3311   "mtab": "fstab",
   3312   # Git
   3313   "COMMIT_EDITMSG": "gitcommit",
   3314   "MERGE_MSG": "gitcommit",
   3315   "TAG_EDITMSG": "gitcommit",
   3316   "NOTES_EDITMSG": "gitcommit",
   3317   "EDIT_DESCRIPTION": "gitcommit",
   3318   # Git revision list
   3319   ".git-blame-ignore-revs": "gitrevlist",
   3320   # gnash(1) configuration files
   3321   "gnashrc": "gnash",
   3322   ".gnashrc": "gnash",
   3323   "gnashpluginrc": "gnash",
   3324   ".gnashpluginrc": "gnash",
   3325   # Gitolite
   3326   "gitolite.conf": "gitolite",
   3327   # Go (Google)
   3328   "Gopkg.lock": "toml",
   3329   "go.work": "gowork",
   3330   # GoAccess configuration
   3331   "goaccess.conf": "goaccess",
   3332   # GTK RC
   3333   ".gtkrc": "gtkrc",
   3334   "gtkrc": "gtkrc",
   3335   # Haskell
   3336   "cabal.project": "cabalproject",
   3337   # Go checksum file (must be before *.sum Hercules)
   3338   "go.sum": "gosum",
   3339   "go.work.sum": "gosum",
   3340   # Indent profile (must come before IDL *.pro!)
   3341   ".indent.pro": "indent",
   3342   # Indent RC
   3343   "indentrc": "indent",
   3344   # Ipfilter
   3345   "ipf.conf": "ipfilter",
   3346   "ipf6.conf": "ipfilter",
   3347   "ipf.rules": "ipfilter",
   3348   # SysV Inittab
   3349   "inittab": "inittab",
   3350   # JavaScript, ECMAScript, ES module script, CommonJS script
   3351   ".node_repl_history": "javascript",
   3352   # Other files that look like json
   3353   ".prettierrc": "json",
   3354   ".firebaserc": "json",
   3355   ".stylelintrc": "json",
   3356   ".lintstagedrc": "json",
   3357   "flake.lock": "json",
   3358   "deno.lock": "json",
   3359   ".swcrc": "json",
   3360   "composer.lock": "json",
   3361   "symfony.lock": "json",
   3362   # osquery configuration
   3363   "osquery.conf": "jsonc",
   3364   # Kconfig
   3365   "Kconfig": "kconfig",
   3366   "Kconfig.debug": "kconfig",
   3367   "Config.in": "kconfig",
   3368   # Latexmkrc
   3369   ".latexmkrc": "perl",
   3370   "latexmkrc": "perl",
   3371   # LDAP configuration
   3372   "ldaprc": "ldapconf",
   3373   ".ldaprc": "ldapconf",
   3374   "ldap.conf": "ldapconf",
   3375   # Luadoc, Ldoc (must be before *.ld)
   3376   "config.ld": "lua",
   3377   # lf configuration (lfrc)
   3378   "lfrc": "lf",
   3379   # Lilo: Linux loader
   3380   "lilo.conf": "lilo",
   3381   # SBCL implementation of Common Lisp
   3382   "sbclrc": "lisp",
   3383   ".sbclrc": "lisp",
   3384   # Luau config
   3385   ".luaurc": "jsonc",
   3386   # Luacheck
   3387   ".luacheckrc": "lua",
   3388   # Mailcap configuration file
   3389   ".mailcap": "mailcap",
   3390   "mailcap": "mailcap",
   3391   # Meson Build system config
   3392   "meson.build": "meson",
   3393   "meson.options": "meson",
   3394   "meson_options.txt": "meson",
   3395   # msmtp
   3396   "msmtprc": "msmtp",
   3397   ".msmtprc": "msmtp",
   3398   # Mrxvtrc
   3399   "mrxvtrc": "mrxvtrc",
   3400   ".mrxvtrc": "mrxvtrc",
   3401   # Noemutt setup file
   3402   "Neomuttrc": "neomuttrc",
   3403   # Netrc
   3404   ".netrc": "netrc",
   3405   # NPM RC file
   3406   "npmrc": "dosini",
   3407   ".npmrc": "dosini",
   3408   # ondir
   3409   ".ondirrc": "ondir",
   3410   # OpenAL Soft config files
   3411   ".alsoftrc": "dosini",
   3412   "alsoft.conf": "dosini",
   3413   "alsoft.ini": "dosini",
   3414   "alsoftrc.sample": "dosini",
   3415   # Packet filter conf
   3416   "pf.conf": "pf",
   3417   # ini style config files, using # comments
   3418   "pacman.conf": "confini",
   3419   "mpv.conf": "confini",
   3420   # Pam environment
   3421   "pam_env.conf": "pamenv",
   3422   ".pam_environment": "pamenv",
   3423   # Perl Reply
   3424   ".replyrc": "dosini",
   3425   # Pine config
   3426   ".pinerc": "pine",
   3427   "pinerc": "pine",
   3428   ".pinercex": "pine",
   3429   "pinercex": "pine",
   3430   # Pip requirements
   3431   "requirements.txt": "requirements",
   3432   # Pipenv Pipfiles
   3433   "Pipfile": "toml",
   3434   "Pipfile.lock": "json",
   3435   # Pixi lock
   3436   "pixi.lock": "yaml",
   3437   # Postfix main config
   3438   "main.cf": "pfmain",
   3439   "main.cf.proto": "pfmain",
   3440   # Povray configuration
   3441   ".povrayrc": "povini",
   3442   # Puppet
   3443   "Puppetfile": "ruby",
   3444   # Procmail
   3445   ".procmail": "procmail",
   3446   ".procmailrc": "procmail",
   3447   # PyPA manifest files
   3448   "MANIFEST.in": "pymanifest",
   3449   # QMLdir
   3450   "qmldir": "qmldir",
   3451   # radvd(8) configuration
   3452   "radvd.conf": "radvd",
   3453   # Ratpoison config/command files
   3454   ".ratpoisonrc": "ratpoison",
   3455   "ratpoisonrc": "ratpoison",
   3456   # Readline
   3457   ".inputrc": "readline",
   3458   "inputrc": "readline",
   3459   # R profile file
   3460   ".Rhistory": "r",
   3461   ".Rprofile": "r",
   3462   "Rprofile": "r",
   3463   "Rprofile.site": "r",
   3464   # Resolv.conf
   3465   "resolv.conf": "resolv",
   3466   # Robots.txt
   3467   "robots.txt": "robots",
   3468   # Interactive Ruby shell
   3469   ".irbrc": "ruby",
   3470   "irbrc": "ruby",
   3471   ".irb_history": "ruby",
   3472   "irb_history": "ruby",
   3473   # Bundler
   3474   "Gemfile": "ruby",
   3475   # Samba config
   3476   "smb.conf": "samba",
   3477   # Sendmail
   3478   "sendmail.cf": "sm",
   3479   # SGML catalog file
   3480   "catalog": "catalog",
   3481   # Alpine Linux APKBUILDs are actually POSIX sh scripts with special treatment.
   3482   "APKBUILD": "apkbuild",
   3483   # Screen RC
   3484   ".screenrc": "screen",
   3485   "screenrc": "screen",
   3486   # skhd (simple hotkey daemon for macOS)
   3487   ".skhdrc": "skhd",
   3488   "skhdrc": "skhd",
   3489   # SLRN
   3490   ".slrnrc": "slrnrc",
   3491   # Squid
   3492   "squid.conf": "squid",
   3493   # OpenSSH server configuration
   3494   "sshd_config": "sshdconfig",
   3495   # Tags
   3496   "tags": "tags",
   3497   # Xilinx's xsct and xsdb use tcl
   3498   ".xsctcmdhistory": "tcl",
   3499   ".xsdbcmdhistory": "tcl",
   3500   # TeX configuration
   3501   "texmf.cnf": "texmf",
   3502   # Tidy config
   3503   ".tidyrc": "tidy",
   3504   "tidyrc": "tidy",
   3505   "tidy.conf": "tidy",
   3506   # TF (TinyFugue) mud client
   3507   ".tfrc": "tf",
   3508   "tfrc": "tf",
   3509   # Tilefile
   3510   "Tiltfile": "tiltfile",
   3511   "tiltfile": "tiltfile",
   3512   # Trustees
   3513   "trustees.conf": "trustees",
   3514   # Vagrant (uses Ruby syntax)
   3515   "Vagrantfile": "ruby",
   3516   # Viminfo file
   3517   ".viminfo": "viminfo",
   3518   "_viminfo": "viminfo",
   3519   # Vgrindefs file
   3520   "vgrindefs": "vgrindefs",
   3521   # Wget config
   3522   ".wgetrc": "wget",
   3523   "wgetrc": "wget",
   3524   # Wget2 config
   3525   ".wget2rc": "wget2",
   3526   "wget2rc": "wget2",
   3527   # WvDial
   3528   "wvdial.conf": "wvdial",
   3529   ".wvdialrc": "wvdial",
   3530   # CVS RC file
   3531   ".cvsrc": "cvsrc",
   3532   # X11vnc
   3533   ".x11vncrc": "conf",
   3534   # Xprofile
   3535   ".xprofile": "sh",
   3536   # X compose file
   3537   ".XCompose": "xcompose",
   3538   "Compose": "xcompose",
   3539   # MSBUILD configuration files are also XML
   3540   "Directory.Packages.props": "xml",
   3541   "Directory.Build.targets": "xml",
   3542   "Directory.Build.props": "xml",
   3543   # ATI graphics driver configuration
   3544   "fglrxrc": "xml",
   3545   # Nfs
   3546   "nfs.conf": "dosini",
   3547   "nfsmount.conf": "dosini",
   3548   # Yarn lock
   3549   "yarn.lock": "yaml",
   3550   # Zathurarc
   3551   "zathurarc": "zathurarc",
   3552 }
   3553 
   3554 # Uncomment this line to check for compilation errors early
   3555 # defcompile