diff options
Diffstat (limited to 'runtime/lua/vim/filetype.lua')
| -rw-r--r-- | runtime/lua/vim/filetype.lua | 1405 |
1 files changed, 815 insertions, 590 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index d1fdd0aa16..d3910e26eb 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -4,12 +4,13 @@ local fn = vim.fn local M = {} --- @alias vim.filetype.mapfn fun(path:string,bufnr:integer, ...):string?, fun(b:integer)? ---- @alias vim.filetype.maptbl {[1]:string|vim.filetype.mapfn, [2]:{priority:integer}} +--- @alias vim.filetype.mapopts { parent: string, priority: number } +--- @alias vim.filetype.maptbl [string|vim.filetype.mapfn, vim.filetype.mapopts] --- @alias vim.filetype.mapping.value string|vim.filetype.mapfn|vim.filetype.maptbl --- @alias vim.filetype.mapping table<string,vim.filetype.mapping.value> --- @param ft string|vim.filetype.mapfn ---- @param opts? {priority:integer} +--- @param opts? vim.filetype.mapopts --- @return vim.filetype.maptbl local function starsetf(ft, opts) return { @@ -26,6 +27,9 @@ local function starsetf(ft, opts) end end, { + -- Allow setting "parent" to be reused in closures, but don't have default as it will be + -- assigned later from grouping + parent = opts and opts.parent, -- Starset matches should have lowest priority by default priority = (opts and opts.priority) or -math.huge, }, @@ -144,6 +148,9 @@ end local function detect_noext(path, bufnr) local root = fn.fnamemodify(path, ':r') + if root == path then + return + end return M.match({ buf = bufnr, filename = root }) end @@ -170,9 +177,15 @@ end -- luacheck: push no unused args -- luacheck: push ignore 122 --- Filetypes based on file extension +-- Filetype detection logic is encoded in three tables: +-- 1. `extension` for literal extension lookup +-- 2. `filename` for literal full path or basename lookup; +-- 3. `pattern` for matching filenames or paths against Lua patterns, +-- optimized for fast lookup. +-- See `:h dev-vimpatch-filetype` for guidance when porting Vim filetype patches. + ---@diagnostic disable: unused-local ---- @type vim.filetype.mapping +---@type vim.filetype.mapping local extension = { -- BEGIN EXTENSION ['8th'] = '8th', @@ -190,6 +203,7 @@ local extension = { aidl = 'aidl', aml = 'aml', run = 'ampl', + g4 = 'antlr4', scpt = 'applescript', ino = 'arduino', pde = 'arduino', @@ -203,12 +217,17 @@ local extension = { return 'aspvbs' end, asm = detect.asm, + s = detect.asm, + S = detect.asm, + a = detect.asm, + A = detect.asm, lst = detect.asm, mac = detect.asm, asn1 = 'asn', asn = 'asn', asp = detect.asp, astro = 'astro', + asy = 'asy', atl = 'atlas', as = 'atlas', zed = 'authzed', @@ -232,6 +251,7 @@ local extension = { db = detect.bindzone, bicep = 'bicep', bicepparam = 'bicep', + zone = 'bindzone', bb = 'bitbake', bbappend = 'bitbake', bbclass = 'bitbake', @@ -257,10 +277,14 @@ local extension = { cdc = 'cdc', cdl = 'cdl', toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'), + cedar = 'cedar', cfc = 'cf', cfm = 'cf', cfi = 'cf', hgrc = 'cfg', + cfg = detect.cfg, + Cfg = detect.cfg, + CFG = detect.cfg, chf = 'ch', chai = 'chaiscript', ch = detect.change, @@ -281,7 +305,6 @@ local extension = { cook = 'cook', cmake = 'cmake', cmod = 'cmod', - lib = 'cobol', cob = 'cobol', cbl = 'cobol', atg = 'coco', @@ -344,6 +367,9 @@ local extension = { dart = 'dart', drt = 'dart', ds = 'datascript', + dat = detect.dat, + Dat = detect.dat, + DAT = detect.dat, dcd = 'dcd', decl = detect.decl, dec = detect.decl, @@ -366,6 +392,9 @@ local extension = { gv = 'dot', drac = 'dracula', drc = 'dracula', + lvs = 'dracula', + lpe = 'dracula', + dsp = detect.dsp, dtd = 'dtd', d = detect.dtrace, dts = 'dts', @@ -417,6 +446,7 @@ local extension = { fal = 'falcon', fan = 'fan', fwt = 'fan', + lib = 'faust', fnl = 'fennel', m4gl = 'fgl', ['4gl'] = 'fgl', @@ -468,8 +498,21 @@ local extension = { gmi = 'gemtext', gemini = 'gemtext', gift = 'gift', + prettierignore = 'gitignore', gleam = 'gleam', + vert = 'glsl', + tesc = 'glsl', + tese = 'glsl', glsl = 'glsl', + geom = 'glsl', + frag = 'glsl', + comp = 'glsl', + rgen = 'glsl', + rmiss = 'glsl', + rchit = 'glsl', + rahit = 'glsl', + rint = 'glsl', + rcall = 'glsl', gn = 'gn', gni = 'gn', gnuplot = 'gnuplot', @@ -535,6 +578,7 @@ local extension = { stm = detect.html, htt = 'httest', htb = 'httest', + http = 'http', hurl = 'hurl', hw = detect.hw, module = detect.hw, @@ -572,6 +616,7 @@ local extension = { jsx = 'javascriptreact', clp = 'jess', jgr = 'jgraph', + jinja = 'jinja', jjdescription = 'jj', j73 = 'jovial', jov = 'jovial', @@ -582,6 +627,7 @@ local extension = { json = 'json', jsonp = 'json', geojson = 'json', + mcmeta = 'json', webmanifest = 'json', ipynb = 'json', ['jupyterlab-settings'] = 'json', @@ -606,6 +652,9 @@ local extension = { kts = 'kotlin', kt = 'kotlin', ktm = 'kotlin', + sub = 'krl', + Sub = 'krl', + SUB = 'krl', ks = 'kscript', k = 'kwt', ACE = 'lace', @@ -639,6 +688,9 @@ local extension = { lt = 'lite', lite = 'lite', livemd = 'livebook', + log = detect.log, + Log = detect.log, + LOG = detect.log, lgt = 'logtalk', lotos = 'lotos', lot = detect_line1('\\contentsline', 'tex', 'lotos'), @@ -664,9 +716,8 @@ local extension = { return not (path:find('html%.m4$') or path:find('fvwm2rc')) and 'm4' or nil end, eml = 'mail', - mk = 'make', - mak = 'make', - dsp = 'make', + mk = detect.make, + mak = detect.make, page = 'mallard', map = 'map', mws = 'maple', @@ -679,7 +730,6 @@ local extension = { markdown = detect.markdown, mdown = detect.markdown, mhtml = 'mason', - comp = 'mason', mason = 'mason', master = 'master', mas = 'master', @@ -689,6 +739,8 @@ local extension = { dm3 = 'maxima', dmt = 'maxima', wxm = 'maxima', + mw = 'mediawiki', + wiki = 'mediawiki', mel = 'mel', mmd = 'mermaid', mmdc = 'mermaid', @@ -702,9 +754,17 @@ local extension = { mixal = 'mix', mm = detect.mm, nb = 'mma', + wl = 'mma', mmp = 'mmp', mms = detect.mms, + mod = detect.mod, + Mod = detect.mod, + MOD = detect.mod, DEF = 'modula2', + m3 = 'modula3', + i3 = 'modula3', + mg = 'modula3', + ig = 'modula3', lm3 = 'modula3', mojo = 'mojo', ['🔥'] = 'mojo', -- 🙄 @@ -729,6 +789,14 @@ local extension = { n1ql = 'n1ql', nql = 'n1ql', nanorc = 'nanorc', + NSA = 'natural', + NSC = 'natural', + NSG = 'natural', + NSL = 'natural', + NSM = 'natural', + NSN = 'natural', + NSP = 'natural', + NSS = 'natural', ncf = 'ncf', nginx = 'nginx', nim = 'nim', @@ -738,6 +806,15 @@ local extension = { nix = 'nix', norg = 'norg', nqc = 'nqc', + ['1'] = detect.nroff, + ['2'] = detect.nroff, + ['3'] = detect.nroff, + ['4'] = detect.nroff, + ['5'] = detect.nroff, + ['6'] = detect.nroff, + ['7'] = detect.nroff, + ['8'] = detect.nroff, + ['9'] = detect.nroff, roff = 'nroff', tmac = 'nroff', man = 'nroff', @@ -769,6 +846,14 @@ local extension = { ['or'] = 'openroad', scad = 'openscad', ovpn = 'openvpn', + opl = 'opl', + opL = 'opl', + oPl = 'opl', + oPL = 'opl', + Opl = 'opl', + OpL = 'opl', + OPl = 'opl', + OPL = 'opl', ora = 'ora', org = 'org', org_archive = 'org', @@ -800,6 +885,16 @@ local extension = { ctp = 'php', php = 'php', phpt = 'php', + php0 = 'php', + php1 = 'php', + php2 = 'php', + php3 = 'php', + php4 = 'php', + php5 = 'php', + php6 = 'php', + php7 = 'php', + php8 = 'php', + php9 = 'php', phtml = 'php', theme = 'php', pike = 'pike', @@ -832,6 +927,9 @@ local extension = { it = 'ppwiz', ih = 'ppwiz', action = 'privoxy', + prg = detect.prg, + Prg = detect.prg, + PRG = detect.prg, pc = 'proc', pdb = 'prolog', pml = 'promela', @@ -873,6 +971,19 @@ local extension = { t6 = 'raku', p6 = 'raku', raml = 'raml', + sysx = 'rapid', + sysX = 'rapid', + Sysx = 'rapid', + SysX = 'rapid', + SYSX = 'rapid', + SYSx = 'rapid', + modx = 'rapid', + modX = 'rapid', + Modx = 'rapid', + ModX = 'rapid', + MODX = 'rapid', + MODx = 'rapid', + rasi = 'rasi', rbs = 'rbs', rego = 'rego', rem = 'remind', @@ -929,6 +1040,7 @@ local extension = { rake = 'ruby', rs = 'rust', sage = 'sage', + sls = 'salt', sas = 'sas', sass = 'sass', sa = 'sather', @@ -952,6 +1064,7 @@ local extension = { ebuild = detect.bash, eclass = detect.bash, env = detect.sh, + envrc = detect.sh, ksh = detect.ksh, sh = detect.sh, mdd = 'sh', @@ -984,6 +1097,7 @@ local extension = { smt = 'smith', smithy = 'smithy', sml = 'sml', + smk = 'snakemake', spt = 'snobol4', sno = 'snobol4', sln = 'solution', @@ -1006,6 +1120,9 @@ local extension = { sqi = 'sqr', sqr = 'sqr', nut = 'squirrel', + src = detect.src, + Src = detect.src, + SRC = detect.src, s28 = 'srec', s37 = 'srec', srec = 'srec', @@ -1030,8 +1147,12 @@ local extension = { svelte = 'svelte', svg = 'svg', swift = 'swift', + swiftinterface = 'swift', swig = 'swig', swg = 'swig', + sys = detect.sys, + Sys = detect.sys, + SYS = detect.sys, svh = 'systemverilog', sv = 'systemverilog', cmm = 'trace32', @@ -1060,6 +1181,7 @@ local extension = { nls = 'tex', thm = 'tex', eps_tex = 'tex', + pdf_tex = 'tex', pygtex = 'tex', pygstyle = 'tex', clo = 'tex', @@ -1153,6 +1275,8 @@ local extension = { wbt = 'winbatch', wit = 'wit', wml = 'wml', + wsf = 'wsh', + wsc = 'wsh', wsml = 'wsml', ad = 'xdefaults', xhtml = 'xhtml', @@ -1206,6 +1330,8 @@ local extension = { z8a = 'z8a', zig = 'zig', zon = 'zig', + ziggy = 'ziggy', + ['ziggy-schema'] = 'ziggy_schema', zu = 'zimbu', zut = 'zimbutempl', zs = 'zserio', @@ -1261,8 +1387,7 @@ local extension = { ['dpkg-new'] = detect_noext, ['in'] = function(path, bufnr) if vim.fs.basename(path) ~= 'configure.in' then - local root = fn.fnamemodify(path, ':r') - return M.match({ buf = bufnr, filename = root }) + return detect_noext(path, bufnr) end end, new = detect_noext, @@ -1275,7 +1400,7 @@ local extension = { -- END EXTENSION } ---- @type vim.filetype.mapping +---@type vim.filetype.mapping local filename = { -- BEGIN FILENAME ['a2psrc'] = 'a2ps', @@ -1290,7 +1415,17 @@ local filename = { ['/.aptitude/config'] = 'aptconf', ['=tagging-method'] = 'arch', ['.arch-inventory'] = 'arch', + ['makefile.am'] = 'automake', + ['Makefile.am'] = 'automake', ['GNUmakefile.am'] = 'automake', + ['.bash_aliases'] = detect.bash, + ['.bash-aliases'] = detect.bash, + ['.bash_history'] = detect.bash, + ['.bash-history'] = detect.bash, + ['.bash_logout'] = detect.bash, + ['.bash-logout'] = detect.bash, + ['.bash_profile'] = detect.bash, + ['.bash-profile'] = detect.bash, ['named.root'] = 'bindzone', WORKSPACE = 'bzl', ['WORKSPACE.bzlmod'] = 'bzl', @@ -1373,6 +1508,7 @@ local filename = { jbuild = 'dune', ['dune-workspace'] = 'dune', ['dune-project'] = 'dune', + ['dune-file'] = 'dune', Earthfile = 'earthfile', ['.editorconfig'] = 'editorconfig', ['elinks.conf'] = 'elinks', @@ -1409,6 +1545,7 @@ local filename = { gnashpluginrc = 'gnash', gnashrc = 'gnash', ['.gnuplot_history'] = 'gnuplot', + ['goaccess.conf'] = 'goaccess', ['go.sum'] = 'gosum', ['go.work.sum'] = 'gosum', ['go.work'] = 'gowork', @@ -1445,11 +1582,15 @@ local filename = { ['ipf.conf'] = 'ipfilter', ['ipf6.conf'] = 'ipfilter', ['ipf.rules'] = 'ipfilter', + ['.bun_repl_history'] = 'javascript', ['.node_repl_history'] = 'javascript', + ['deno_history.txt'] = 'javascript', ['Pipfile.lock'] = 'json', ['.firebaserc'] = 'json', ['.prettierrc'] = 'json', ['.stylelintrc'] = 'json', + ['.lintstagedrc'] = 'json', + ['deno.lock'] = 'json', ['flake.lock'] = 'json', ['.babelrc'] = 'jsonc', ['.eslintrc'] = 'jsonc', @@ -1461,9 +1602,14 @@ local filename = { ['.swrc'] = 'jsonc', ['.vsconfig'] = 'jsonc', ['.justfile'] = 'just', + ['justfile'] = 'just', + ['Justfile'] = 'just', Kconfig = 'kconfig', ['Kconfig.debug'] = 'kconfig', ['Config.in'] = 'kconfig', + ['ldaprc'] = 'ldapconf', + ['.ldaprc'] = 'ldapconf', + ['ldap.conf'] = 'ldapconf', ['lftp.conf'] = 'lftp', ['.lftprc'] = 'lftp', ['/.libao'] = 'libao', @@ -1509,6 +1655,8 @@ local filename = { mrxvtrc = 'mrxvtrc', ['.mrxvtrc'] = 'mrxvtrc', ['.msmtprc'] = 'msmtp', + ['Muttngrc'] = 'muttrc', + ['Muttrc'] = 'muttrc', ['.mysql_history'] = 'mysql', ['/etc/nanorc'] = 'nanorc', Neomuttrc = 'neomuttrc', @@ -1520,6 +1668,7 @@ local filename = { ['octave.conf'] = 'octave', ['.ondirrc'] = 'ondir', opam = 'opam', + ['opam.locked'] = 'opam', ['pacman.log'] = 'pacmanlog', ['/etc/pam.conf'] = 'pamconf', ['pam_env.conf'] = 'pamenv', @@ -1532,6 +1681,9 @@ local filename = { ['/etc/shadow-'] = 'passwd', ['/etc/shadow'] = 'passwd', ['/etc/passwd.edit'] = 'passwd', + ['.gitolite.rc'] = 'perl', + ['gitolite.rc'] = 'perl', + ['example.gitolite.rc'] = 'perl', ['latexmkrc'] = 'perl', ['.latexmkrc'] = 'perl', ['pf.conf'] = 'pf', @@ -1587,6 +1739,10 @@ local filename = { irbrc = 'ruby', ['.irb_history'] = 'ruby', irb_history = 'ruby', + ['rakefile'] = 'ruby', + ['Rakefile'] = 'ruby', + ['rantfile'] = 'ruby', + ['Rantfile'] = 'ruby', Vagrantfile = 'ruby', ['smb.conf'] = 'samba', screenrc = 'screen', @@ -1597,6 +1753,8 @@ local filename = { ['/etc/serial.conf'] = 'setserial', ['/etc/udev/cdsymlinks.conf'] = 'sh', ['.ash_history'] = 'sh', + ['.devscripts'] = 'sh', + ['devscripts.conf'] = 'sh', ['makepkg.conf'] = 'sh', ['.makepkg.conf'] = 'sh', ['user-dirs.dirs'] = 'sh', @@ -1618,6 +1776,7 @@ local filename = { ['/etc/slp.spi'] = 'slpspi', ['.slrnrc'] = 'slrnrc', ['sendmail.cf'] = 'sm', + Snakefile = 'snakemake', ['.sqlite_history'] = 'sql', ['squid.conf'] = 'squid', ['ssh_config'] = 'sshconfig', @@ -1637,7 +1796,7 @@ local filename = { ['.xsdbcmdhistory'] = 'tcl', ['texmf.cnf'] = 'texmf', COPYING = 'text', - README = 'text', + README = detect_seq(detect.haredoc, 'text'), LICENSE = 'text', AUTHORS = 'text', tfrc = 'tf', @@ -1703,528 +1862,568 @@ local filename = { } -- Re-use closures as much as possible -local detect_apache = starsetf('apache') -local detect_muttrc = starsetf('muttrc') -local detect_neomuttrc = starsetf('neomuttrc') +local detect_apache_diretc = starsetf('apache', { parent = '/etc/' }) +local detect_apache_dotconf = starsetf('apache', { parent = '%.conf' }) +local detect_muttrc = starsetf('muttrc', { parent = 'utt' }) +local detect_neomuttrc = starsetf('neomuttrc', { parent = 'utt' }) +local detect_xkb = starsetf('xkb', { parent = '/usr/' }) ---- @type vim.filetype.mapping +---@type table<string,vim.filetype.mapping> local pattern = { -- BEGIN PATTERN - ['.*/etc/a2ps/.*%.cfg'] = 'a2ps', - ['.*/etc/a2ps%.cfg'] = 'a2ps', - ['.*/usr/share/alsa/alsa%.conf'] = 'alsaconf', - ['.*/etc/asound%.conf'] = 'alsaconf', - ['.*/etc/apache2/sites%-.*/.*%.com'] = 'apache', - ['.*/etc/httpd/.*%.conf'] = 'apache', - ['.*/etc/apache2/.*%.conf.*'] = detect_apache, - ['.*/etc/apache2/conf%..*/.*'] = detect_apache, - ['.*/etc/apache2/mods%-.*/.*'] = detect_apache, - ['.*/etc/apache2/sites%-.*/.*'] = detect_apache, - ['access%.conf.*'] = detect_apache, - ['apache%.conf.*'] = detect_apache, - ['apache2%.conf.*'] = detect_apache, - ['httpd%.conf.*'] = detect_apache, - ['srm%.conf.*'] = detect_apache, - ['.*/etc/httpd/conf%..*/.*'] = detect_apache, - ['.*/etc/httpd/conf%.d/.*%.conf.*'] = detect_apache, - ['.*/etc/httpd/mods%-.*/.*'] = detect_apache, - ['.*/etc/httpd/sites%-.*/.*'] = detect_apache, - ['.*/etc/proftpd/.*%.conf.*'] = starsetf('apachestyle'), - ['.*/etc/proftpd/conf%..*/.*'] = starsetf('apachestyle'), - ['proftpd%.conf.*'] = starsetf('apachestyle'), - ['.*asterisk/.*%.conf.*'] = starsetf('asterisk'), - ['.*asterisk.*/.*voicemail%.conf.*'] = starsetf('asteriskvm'), - ['.*/%.aptitude/config'] = 'aptconf', - ['.*%.[aA]'] = detect.asm, - ['.*%.[sS]'] = detect.asm, - ['[mM]akefile%.am'] = 'automake', - ['.*/bind/db%..*'] = starsetf('bindzone'), - ['.*/named/db%..*'] = starsetf('bindzone'), - ['.*/build/conf/.*%.conf'] = 'bitbake', - ['.*/meta/conf/.*%.conf'] = 'bitbake', - ['.*/meta%-.*/conf/.*%.conf'] = 'bitbake', - ['.*%.blade%.php'] = 'blade', - ['bzr_log%..*'] = 'bzr', - ['.*enlightenment/.*%.cfg'] = 'c', - ['.*/%.cabal/config'] = 'cabalconfig', - ['.*/cabal/config'] = 'cabalconfig', - ['cabal%.project%..*'] = starsetf('cabalproject'), - ['.*/%.calendar/.*'] = starsetf('calendar'), - ['.*/share/calendar/.*/calendar%..*'] = starsetf('calendar'), - ['.*/share/calendar/calendar%..*'] = starsetf('calendar'), - ['sgml%.catalog.*'] = starsetf('catalog'), - ['.*/etc/defaults/cdrdao'] = 'cdrdaoconf', - ['.*/etc/cdrdao%.conf'] = 'cdrdaoconf', - ['.*/etc/default/cdrdao'] = 'cdrdaoconf', - ['.*hgrc'] = 'cfg', - ['.*%.[Cc][Ff][Gg]'] = { - detect.cfg, - -- Decrease priority to avoid conflicts with more specific patterns - -- such as '.*/etc/a2ps/.*%.cfg', '.*enlightenment/.*%.cfg', etc. - { priority = -1 }, + ['/debian/'] = { + ['/debian/changelog$'] = 'debchangelog', + ['/debian/control$'] = 'debcontrol', + ['/debian/copyright$'] = 'debcopyright', + ['/debian/patches/'] = detect.dep3patch, + }, + ['/etc/'] = { + ['/etc/a2ps/.*%.cfg$'] = 'a2ps', + ['/etc/a2ps%.cfg$'] = 'a2ps', + ['/etc/asound%.conf$'] = 'alsaconf', + ['/etc/apache2/sites%-.*/.*%.com$'] = 'apache', + ['/etc/httpd/.*%.conf$'] = 'apache', + ['/etc/apache2/.*%.conf'] = detect_apache_diretc, + ['/etc/apache2/conf%..*/'] = detect_apache_diretc, + ['/etc/apache2/mods%-.*/'] = detect_apache_diretc, + ['/etc/apache2/sites%-.*/'] = detect_apache_diretc, + ['/etc/httpd/conf%..*/'] = detect_apache_diretc, + ['/etc/httpd/conf%.d/.*%.conf'] = detect_apache_diretc, + ['/etc/httpd/mods%-.*/'] = detect_apache_diretc, + ['/etc/httpd/sites%-.*/'] = detect_apache_diretc, + ['/etc/proftpd/.*%.conf'] = starsetf('apachestyle'), + ['/etc/proftpd/conf%..*/'] = starsetf('apachestyle'), + ['/etc/cdrdao%.conf$'] = 'cdrdaoconf', + ['/etc/default/cdrdao$'] = 'cdrdaoconf', + ['/etc/defaults/cdrdao$'] = 'cdrdaoconf', + ['/etc/translate%-shell$'] = 'clojure', + ['/etc/hostname%.'] = starsetf('config'), + ['/etc/cron%.d/'] = starsetf('crontab'), + ['/etc/apt/sources%.list%.d/.*%.sources$'] = 'deb822sources', + ['/etc/apt/sources%.list%.d/.*%.list$'] = 'debsources', + ['/etc/apt/sources%.list$'] = 'debsources', + ['/etc/DIR_COLORS$'] = 'dircolors', + ['/etc/dnsmasq%.conf$'] = 'dnsmasq', + ['/etc/dnsmasq%.d/'] = starsetf('dnsmasq'), + ['/etc/yum%.conf$'] = 'dosini', + ['/etc/yum%.repos%.d/'] = starsetf('dosini'), + ['/etc/gitconfig%.d/'] = starsetf('gitconfig'), + ['/etc/gitconfig$'] = 'gitconfig', + ['/etc/gitattributes$'] = 'gitattributes', + ['/etc/group$'] = 'group', + ['/etc/group%-$'] = 'group', + ['/etc/group%.edit$'] = 'group', + ['/etc/gshadow%-$'] = 'group', + ['/etc/gshadow%.edit$'] = 'group', + ['/etc/gshadow$'] = 'group', + ['/etc/grub%.conf$'] = 'grub', + ['/etc/host%.conf$'] = 'hostconf', + ['/etc/hosts%.allow$'] = 'hostsaccess', + ['/etc/hosts%.deny$'] = 'hostsaccess', + ['/etc/initng/.*/.*%.i$'] = 'initng', + ['/etc/libao%.conf$'] = 'libao', + ['/etc/.*limits%.conf$'] = 'limits', + ['/etc/.*limits%.d/.*%.conf$'] = 'limits', + ['/etc/limits$'] = 'limits', + ['/etc/logcheck/.*%.d.*/'] = starsetf('logcheck'), + ['/etc/login%.access$'] = 'loginaccess', + ['/etc/login%.defs$'] = 'logindefs', + ['/etc/aliases$'] = 'mailaliases', + ['/etc/mail/aliases$'] = 'mailaliases', + ['/etc/man%.conf$'] = 'manconf', + ['/etc/conf%.modules$'] = 'modconf', + ['/etc/modprobe%.'] = starsetf('modconf'), + ['/etc/modules%.conf$'] = 'modconf', + ['/etc/modules$'] = 'modconf', + ['/etc/modutils/'] = starsetf(function(path, bufnr) + if fn.executable(fn.expand(path)) ~= 1 then + return 'modconf' + end + end), + ['/etc/Muttrc%.d/'] = starsetf('muttrc'), + ['/etc/nanorc$'] = 'nanorc', + ['/etc/nginx/'] = 'nginx', + ['/etc/pam%.conf$'] = 'pamconf', + ['/etc/pam%.d/'] = starsetf('pamconf'), + ['/etc/passwd%-$'] = 'passwd', + ['/etc/shadow$'] = 'passwd', + ['/etc/shadow%.edit$'] = 'passwd', + ['/etc/passwd$'] = 'passwd', + ['/etc/passwd%.edit$'] = 'passwd', + ['/etc/shadow%-$'] = 'passwd', + ['/etc/pinforc$'] = 'pinfo', + ['/etc/protocols$'] = 'protocols', + ['/etc/sensors%.d/[^.]'] = starsetf('sensors'), + ['/etc/sensors%.conf$'] = 'sensors', + ['/etc/sensors3%.conf$'] = 'sensors', + ['/etc/services$'] = 'services', + ['/etc/serial%.conf$'] = 'setserial', + ['/etc/udev/cdsymlinks%.conf$'] = 'sh', + ['/etc/profile$'] = detect.sh, + ['/etc/slp%.conf$'] = 'slpconf', + ['/etc/slp%.reg$'] = 'slpreg', + ['/etc/slp%.spi$'] = 'slpspi', + ['/etc/sudoers%.d/'] = starsetf('sudoers'), + ['/etc/ssh/ssh_config%.d/.*%.conf$'] = 'sshconfig', + ['/etc/ssh/sshd_config%.d/.*%.conf$'] = 'sshdconfig', + ['/etc/sudoers$'] = 'sudoers', + ['/etc/sysctl%.conf$'] = 'sysctl', + ['/etc/sysctl%.d/.*%.conf$'] = 'sysctl', + ['/etc/systemd/.*%.conf%.d/.*%.conf$'] = 'systemd', + ['/etc/systemd/system/.*%.d/.*%.conf$'] = 'systemd', + ['/etc/systemd/system/.*%.d/%.#'] = 'systemd', + ['/etc/systemd/system/%.#'] = 'systemd', + ['/etc/config/'] = starsetf(detect.uci), + ['/etc/udev/udev%.conf$'] = 'udevconf', + ['/etc/udev/permissions%.d/.*%.permissions$'] = 'udevperm', + ['/etc/updatedb%.conf$'] = 'updatedb', + ['/etc/init/.*%.conf$'] = 'upstart', + ['/etc/init/.*%.override$'] = 'upstart', + ['/etc/xinetd%.conf$'] = 'xinetd', + ['/etc/xinetd%.d/'] = starsetf('xinetd'), + ['/etc/blkid%.tab%.old$'] = 'xml', + ['/etc/blkid%.tab$'] = 'xml', + ['/etc/xdg/menus/.*%.menu$'] = 'xml', + ['/etc/zprofile$'] = 'zsh', }, - ['[cC]hange[lL]og.*'] = starsetf(detect.changelog), - ['.*%.%.ch'] = 'chill', - ['.*/etc/translate%-shell'] = 'clojure', - ['.*%.cmake%.in'] = 'cmake', - -- */cmus/rc and */.cmus/rc - ['.*/%.?cmus/rc'] = 'cmusrc', - -- */cmus/*.theme and */.cmus/*.theme - ['.*/%.?cmus/.*%.theme'] = 'cmusrc', - ['.*/%.cmus/autosave'] = 'cmusrc', - ['.*/%.cmus/command%-history'] = 'cmusrc', - ['.*/etc/hostname%..*'] = starsetf('config'), - ['crontab%..*'] = starsetf('crontab'), - ['.*/etc/cron%.d/.*'] = starsetf('crontab'), - ['%.cshrc.*'] = detect.csh, - ['%.login.*'] = detect.csh, - ['cvs%d+'] = 'cvs', - ['.*%.[Dd][Aa][Tt]'] = detect.dat, - ['.*/debian/patches/.*'] = detect.dep3patch, - ['.*/etc/dnsmasq%.d/.*'] = starsetf('dnsmasq'), - ['Containerfile%..*'] = starsetf('dockerfile'), - ['Dockerfile%..*'] = starsetf('dockerfile'), - ['.*/etc/yum%.repos%.d/.*'] = starsetf('dosini'), - ['drac%..*'] = starsetf('dracula'), - ['.*/debian/changelog'] = 'debchangelog', - ['.*/debian/control'] = 'debcontrol', - ['.*/debian/copyright'] = 'debcopyright', - ['.*/etc/apt/sources%.list%.d/.*%.list'] = 'debsources', - ['.*/etc/apt/sources%.list'] = 'debsources', - ['.*/etc/apt/sources%.list%.d/.*%.sources'] = 'deb822sources', - ['.*%.directory'] = 'desktop', - ['.*%.desktop'] = 'desktop', - ['dictd.*%.conf'] = 'dictdconf', - ['.*/etc/DIR_COLORS'] = 'dircolors', - ['.*/etc/dnsmasq%.conf'] = 'dnsmasq', - ['php%.ini%-.*'] = 'dosini', - ['.*/%.aws/config'] = 'confini', - ['.*/%.aws/credentials'] = 'confini', - ['.*/etc/yum%.conf'] = 'dosini', - ['.*/lxqt/.*%.conf'] = 'dosini', - ['.*/screengrab/.*%.conf'] = 'dosini', - ['.*/bpython/config'] = 'dosini', - ['.*/mypy/config'] = 'dosini', - ['.*/flatpak/repo/config'] = 'dosini', - ['.*lvs'] = 'dracula', - ['.*lpe'] = 'dracula', - ['.*/dtrace/.*%.d'] = 'dtrace', - ['.*esmtprc'] = 'esmtprc', - ['.*Eterm/.*%.cfg'] = 'eterm', - ['.*s6.*/up'] = 'execline', - ['.*s6.*/down'] = 'execline', - ['.*s6.*/run'] = 'execline', - ['.*s6.*/finish'] = 'execline', - ['s6%-.*'] = 'execline', - ['[a-zA-Z0-9].*Dict'] = detect.foam, - ['[a-zA-Z0-9].*Dict%..*'] = detect.foam, - ['[a-zA-Z].*Properties'] = detect.foam, - ['[a-zA-Z].*Properties%..*'] = detect.foam, - ['.*Transport%..*'] = detect.foam, - ['.*/constant/g'] = detect.foam, - ['.*/0/.*'] = detect.foam, - ['.*/0%.orig/.*'] = detect.foam, - ['.*/%.fvwm/.*'] = starsetf('fvwm'), - ['.*fvwmrc.*'] = starsetf(detect.fvwm_v1), - ['.*fvwm95.*%.hook'] = starsetf(detect.fvwm_v1), - ['.*fvwm2rc.*'] = starsetf(detect.fvwm_v2), - ['.*/tmp/lltmp.*'] = starsetf('gedcom'), - ['.*/etc/gitconfig%.d/.*'] = starsetf('gitconfig'), - ['.*/gitolite%-admin/conf/.*'] = starsetf('gitolite'), - ['tmac%..*'] = starsetf('nroff'), - ['.*/%.gitconfig%.d/.*'] = starsetf('gitconfig'), - ['.*%.git/.*'] = { - detect.git, - -- Decrease priority to run after simple pattern checks - { priority = -1 }, + ['/log/'] = { + ['/log/auth%.crit$'] = 'messages', + ['/log/auth%.err$'] = 'messages', + ['/log/auth%.info$'] = 'messages', + ['/log/auth%.log$'] = 'messages', + ['/log/auth%.notice$'] = 'messages', + ['/log/auth%.warn$'] = 'messages', + ['/log/auth$'] = 'messages', + ['/log/cron%.crit$'] = 'messages', + ['/log/cron%.err$'] = 'messages', + ['/log/cron%.info$'] = 'messages', + ['/log/cron%.log$'] = 'messages', + ['/log/cron%.notice$'] = 'messages', + ['/log/cron%.warn$'] = 'messages', + ['/log/cron$'] = 'messages', + ['/log/daemon%.crit$'] = 'messages', + ['/log/daemon%.err$'] = 'messages', + ['/log/daemon%.info$'] = 'messages', + ['/log/daemon%.log$'] = 'messages', + ['/log/daemon%.notice$'] = 'messages', + ['/log/daemon%.warn$'] = 'messages', + ['/log/daemon$'] = 'messages', + ['/log/debug%.crit$'] = 'messages', + ['/log/debug%.err$'] = 'messages', + ['/log/debug%.info$'] = 'messages', + ['/log/debug%.log$'] = 'messages', + ['/log/debug%.notice$'] = 'messages', + ['/log/debug%.warn$'] = 'messages', + ['/log/debug$'] = 'messages', + ['/log/kern%.crit$'] = 'messages', + ['/log/kern%.err$'] = 'messages', + ['/log/kern%.info$'] = 'messages', + ['/log/kern%.log$'] = 'messages', + ['/log/kern%.notice$'] = 'messages', + ['/log/kern%.warn$'] = 'messages', + ['/log/kern$'] = 'messages', + ['/log/lpr%.crit$'] = 'messages', + ['/log/lpr%.err$'] = 'messages', + ['/log/lpr%.info$'] = 'messages', + ['/log/lpr%.log$'] = 'messages', + ['/log/lpr%.notice$'] = 'messages', + ['/log/lpr%.warn$'] = 'messages', + ['/log/lpr$'] = 'messages', + ['/log/mail%.crit$'] = 'messages', + ['/log/mail%.err$'] = 'messages', + ['/log/mail%.info$'] = 'messages', + ['/log/mail%.log$'] = 'messages', + ['/log/mail%.notice$'] = 'messages', + ['/log/mail%.warn$'] = 'messages', + ['/log/mail$'] = 'messages', + ['/log/messages%.crit$'] = 'messages', + ['/log/messages%.err$'] = 'messages', + ['/log/messages%.info$'] = 'messages', + ['/log/messages%.log$'] = 'messages', + ['/log/messages%.notice$'] = 'messages', + ['/log/messages%.warn$'] = 'messages', + ['/log/messages$'] = 'messages', + ['/log/news/news%.crit$'] = 'messages', + ['/log/news/news%.err$'] = 'messages', + ['/log/news/news%.info$'] = 'messages', + ['/log/news/news%.log$'] = 'messages', + ['/log/news/news%.notice$'] = 'messages', + ['/log/news/news%.warn$'] = 'messages', + ['/log/news/news$'] = 'messages', + ['/log/syslog%.crit$'] = 'messages', + ['/log/syslog%.err$'] = 'messages', + ['/log/syslog%.info$'] = 'messages', + ['/log/syslog%.log$'] = 'messages', + ['/log/syslog%.notice$'] = 'messages', + ['/log/syslog%.warn$'] = 'messages', + ['/log/syslog$'] = 'messages', + ['/log/user%.crit$'] = 'messages', + ['/log/user%.err$'] = 'messages', + ['/log/user%.info$'] = 'messages', + ['/log/user%.log$'] = 'messages', + ['/log/user%.notice$'] = 'messages', + ['/log/user%.warn$'] = 'messages', + ['/log/user$'] = 'messages', + }, + ['/systemd/'] = { + ['/%.config/systemd/user/%.#'] = 'systemd', + ['/%.config/systemd/user/.*%.d/%.#'] = 'systemd', + ['/%.config/systemd/user/.*%.d/.*%.conf$'] = 'systemd', + ['/systemd/.*%.automount$'] = 'systemd', + ['/systemd/.*%.dnssd$'] = 'systemd', + ['/systemd/.*%.link$'] = 'systemd', + ['/systemd/.*%.mount$'] = 'systemd', + ['/systemd/.*%.netdev$'] = 'systemd', + ['/systemd/.*%.network$'] = 'systemd', + ['/systemd/.*%.nspawn$'] = 'systemd', + ['/systemd/.*%.path$'] = 'systemd', + ['/systemd/.*%.service$'] = 'systemd', + ['/systemd/.*%.slice$'] = 'systemd', + ['/systemd/.*%.socket$'] = 'systemd', + ['/systemd/.*%.swap$'] = 'systemd', + ['/systemd/.*%.target$'] = 'systemd', + ['/systemd/.*%.timer$'] = 'systemd', + }, + ['/usr/'] = { + ['/usr/share/alsa/alsa%.conf$'] = 'alsaconf', + ['/usr/.*/gnupg/options%.skel$'] = 'gpg', + ['/usr/share/upstart/.*%.conf$'] = 'upstart', + ['/usr/share/upstart/.*%.override$'] = 'upstart', + ['/usr/share/X11/xkb/compat/'] = detect_xkb, + ['/usr/share/X11/xkb/geometry/'] = detect_xkb, + ['/usr/share/X11/xkb/keycodes/'] = detect_xkb, + ['/usr/share/X11/xkb/symbols/'] = detect_xkb, + ['/usr/share/X11/xkb/types/'] = detect_xkb, + }, + ['/var/'] = { + ['/var/backups/group%.bak$'] = 'group', + ['/var/backups/gshadow%.bak$'] = 'group', + ['/var/backups/passwd%.bak$'] = 'passwd', + ['/var/backups/shadow%.bak$'] = 'passwd', + }, + ['/conf'] = { + ['/%.aptitude/config$'] = 'aptconf', + ['/build/conf/.*%.conf$'] = 'bitbake', + ['/meta%-.*/conf/.*%.conf$'] = 'bitbake', + ['/meta/conf/.*%.conf$'] = 'bitbake', + ['/%.cabal/config$'] = 'cabalconfig', + ['/cabal/config$'] = 'cabalconfig', + ['/%.aws/config$'] = 'confini', + ['/bpython/config$'] = 'dosini', + ['/flatpak/repo/config$'] = 'dosini', + ['/mypy/config$'] = 'dosini', + ['^${HOME}/%.config/notmuch/.*/config$'] = 'dosini', + ['^${XDG_CONFIG_HOME}/notmuch/.*/config$'] = 'dosini', + ['^${XDG_CONFIG_HOME}/git/config$'] = 'gitconfig', + ['%.git/config%.worktree$'] = 'gitconfig', + ['%.git/config$'] = 'gitconfig', + ['%.git/modules/.*/config$'] = 'gitconfig', + ['%.git/modules/config$'] = 'gitconfig', + ['%.git/worktrees/.*/config%.worktree$'] = 'gitconfig', + ['/%.config/git/config$'] = 'gitconfig', + ['/gitolite%-admin/conf/'] = starsetf('gitolite'), + ['/%.i3/config$'] = 'i3config', + ['/i3/config$'] = 'i3config', + ['/supertux2/config$'] = 'lisp', + ['/%.mplayer/config$'] = 'mplayerconf', + ['/neofetch/config%.conf$'] = 'sh', + ['/%.ssh/config$'] = 'sshconfig', + ['/%.sway/config$'] = 'swayconfig', + ['/sway/config$'] = 'swayconfig', + ['/%.cargo/config$'] = 'toml', + ['/%.bundle/config$'] = 'yaml', + }, + ['/%.'] = { + ['/%.aws/credentials$'] = 'confini', + ['/%.gitconfig%.d/'] = starsetf('gitconfig'), + ['/%.gnupg/gpg%.conf$'] = 'gpg', + ['/%.gnupg/options$'] = 'gpg', + ['/%.icewm/menu$'] = 'icemenu', + ['/%.libao$'] = 'libao', + ['/%.pinforc$'] = 'pinfo', + ['/%.cargo/credentials$'] = 'toml', + ['/%.init/.*%.override$'] = 'upstart', + }, + ['calendar/'] = { + ['/%.calendar/'] = starsetf('calendar'), + ['/share/calendar/.*/calendar%.'] = starsetf('calendar'), + ['/share/calendar/calendar%.'] = starsetf('calendar'), + }, + ['cmus/'] = { + -- */cmus/*.theme and */.cmus/*.theme + ['/%.?cmus/.*%.theme$'] = 'cmusrc', + -- */cmus/rc and */.cmus/rc + ['/%.?cmus/rc$'] = 'cmusrc', + ['/%.cmus/autosave$'] = 'cmusrc', + ['/%.cmus/command%-history$'] = 'cmusrc', + }, + ['git/'] = { + ['%.git/'] = { + detect.git, + -- Decrease priority to run after simple pattern checks + { priority = -1 }, + }, + ['^${XDG_CONFIG_HOME}/git/attributes$'] = 'gitattributes', + ['%.git/info/attributes$'] = 'gitattributes', + ['/%.config/git/attributes$'] = 'gitattributes', + ['^${XDG_CONFIG_HOME}/git/ignore$'] = 'gitignore', + ['%.git/info/exclude$'] = 'gitignore', + ['/%.config/git/ignore$'] = 'gitignore', + }, + ['%.cfg'] = { + ['enlightenment/.*%.cfg$'] = 'c', + ['Eterm/.*%.cfg$'] = 'eterm', + ['baseq[2-3]/.*%.cfg$'] = 'quake', + ['id1/.*%.cfg$'] = 'quake', + ['quake[1-3]/.*%.cfg$'] = 'quake', + ['/tex/latex/.*%.cfg$'] = 'tex', + }, + ['%.conf'] = { + ['^proftpd%.conf'] = starsetf('apachestyle'), + ['^access%.conf'] = detect_apache_dotconf, + ['^apache%.conf'] = detect_apache_dotconf, + ['^apache2%.conf'] = detect_apache_dotconf, + ['^httpd%.conf'] = detect_apache_dotconf, + ['^srm%.conf'] = detect_apache_dotconf, + ['asterisk/.*%.conf'] = starsetf('asterisk'), + ['asterisk.*/.*voicemail%.conf'] = starsetf('asteriskvm'), + ['^dictd.*%.conf$'] = 'dictdconf', + ['/lxqt/.*%.conf$'] = 'dosini', + ['/screengrab/.*%.conf$'] = 'dosini', + ['^${GNUPGHOME}/gpg%.conf$'] = 'gpg', + ['/boot/grub/grub%.conf$'] = 'grub', + ['^lilo%.conf'] = starsetf('lilo'), + ['^named.*%.conf$'] = 'named', + ['^rndc.*%.conf$'] = 'named', + ['/openvpn/.*/.*%.conf$'] = 'openvpn', + ['/%.ssh/.*%.conf$'] = 'sshconfig', + ['^%.?tmux.*%.conf$'] = 'tmux', + ['^%.?tmux.*%.conf'] = { 'tmux', { priority = -1 } }, + ['/%.config/upstart/.*%.conf$'] = 'upstart', + ['/%.config/upstart/.*%.override$'] = 'upstart', + ['/%.init/.*%.conf$'] = 'upstart', + ['/xorg%.conf%.d/.*%.conf$'] = detect.xfree86_v4, + }, + ['sst%.meta'] = { + ['%.%-sst%.meta$'] = 'sisu', + ['%._sst%.meta$'] = 'sisu', + ['%.sst%.meta$'] = 'sisu', + }, + ['file'] = { + ['^Containerfile%.'] = starsetf('dockerfile'), + ['^Dockerfile%.'] = starsetf('dockerfile'), + ['[mM]akefile$'] = detect.make, + ['^[mM]akefile'] = starsetf('make'), + ['^[rR]akefile'] = starsetf('ruby'), + ['^%.profile'] = detect.sh, + }, + ['fvwm'] = { + ['/%.fvwm/'] = starsetf('fvwm'), + ['fvwmrc'] = starsetf(detect.fvwm_v1), + ['fvwm95.*%.hook$'] = starsetf(detect.fvwm_v1), + ['fvwm2rc'] = starsetf(detect.fvwm_v2), + }, + ['nginx'] = { + ['/nginx/.*%.conf$'] = 'nginx', + ['/usr/local/nginx/conf/'] = 'nginx', + ['nginx%.conf$'] = 'nginx', + ['^nginx.*%.conf$'] = 'nginx', + }, + ['require'] = { + ['%-requirements%.txt$'] = 'requirements', + ['^requirements/.*%.txt$'] = 'requirements', + ['^requires/.*%.txt$'] = 'requirements', + }, + ['s6'] = { + ['s6.*/down$'] = 'execline', + ['s6.*/finish$'] = 'execline', + ['s6.*/run$'] = 'execline', + ['s6.*/up$'] = 'execline', + ['^s6%-'] = 'execline', + }, + ['utt'] = { + ['^mutt%-.*%-%w+$'] = 'mail', + ['^mutt' .. str |