From 4b9bb3a1841489a18bbeb124fc11cbf359553ef5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Feb 2023 16:05:45 +0100 Subject: vim-patch:9.0.1278: go.work.sum files are not recognized (#22121) Problem: go.work.sum files are not recognized. Solution: Recognize go.work.sum files as the gosum filetype. (Amaan Qureshi, closes vim/vim#11940) https://github.com/vim/vim/commit/4ad8ae8465e30df38dba31910f130891b16d38a0 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 8144731b09..bc30b3bd11 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1433,6 +1433,7 @@ local filename = { gnashrc = 'gnash', ['.gnuplot'] = 'gnuplot', ['go.sum'] = 'gosum', + ['go.work.sum'] = 'gosum', ['go.work'] = 'gowork', ['.gprc'] = 'gp', ['/.gnupg/gpg.conf'] = 'gpg', -- cgit From 23e34fe534d201a1323ab040cb2201d21fe865cc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 5 Feb 2023 17:59:18 +0100 Subject: vim-patch:9.0.1281: Cadence files are not recognized (#22130) Problem: Cadence files are not recognized. Solution: Recognize Cadence files. (Janez Podhostnik, closes vim/vim#11951) https://github.com/vim/vim/commit/cb626a4692df7154be02b47d6089ec679e95cb44 Co-authored-by: Janez Podhostnik --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index bc30b3bd11..a18abf09ac 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -191,6 +191,7 @@ local extension = { qc = 'c', cabal = 'cabal', capnp = 'capnp', + cdc = 'cdc', cdl = 'cdl', toc = 'cdrtoc', cfc = 'cf', -- cgit From 1675f0e270579036c454c38f28e650b60a3fba1a Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 6 Feb 2023 04:01:17 -0500 Subject: vim-patch:9.0.1282: Ron files are not recognized (#22132) Problem: Ron files are not recognized. Solution: Recognize Ron files. (Amaan Qureshi, closes vim/vim#11948) https://github.com/vim/vim/commit/c8ef30bc2eaec956549510cd4b2efc96b7aee563 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index a18abf09ac..58728a8872 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -871,6 +871,7 @@ local extension = { Snw = 'rnoweb', robot = 'robot', resource = 'robot', + ron = 'ron', rsc = 'routeros', x = 'rpcgen', rpl = 'rpl', -- cgit From 8fbe75b3dda7ab3b9e6df0d5406539bde4c80887 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 7 Feb 2023 10:29:37 +0100 Subject: vim-patch:9.0.1288: FunC files are not recognized (#22153) Problem: FunC files are not recognized. Solution: Recognize FunC files. (Amaan Qureshi, closes vim/vim#11949) https://github.com/vim/vim/commit/91deac45392fe93094b9c31403b1ae771dc71938 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 58728a8872..cdc6e4bb7c 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -423,6 +423,7 @@ local extension = { fsh = 'fsh', fsi = 'fsharp', fsx = 'fsharp', + fc = 'func', fusion = 'fusion', gdb = 'gdb', gdmo = 'gdmo', -- cgit From 1ca4a8b1ddf5256ad53cf486d0b2125434168270 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 8 Feb 2023 09:47:55 +0100 Subject: vim-patch:9.0.1291: Move language files are not recognized (#22162) Problem: Move language files are not recognized. Solution: Recognize Move language files. (Amaan Qureshi, closes vim/vim#11947) https://github.com/vim/vim/commit/6642982beaf4f1f5164f0315a1b3e3c275156089 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index cdc6e4bb7c..1f605b72f3 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -692,6 +692,7 @@ local extension = { isc = 'monk', moo = 'moo', moon = 'moonscript', + move = 'move', mp = 'mp', mpiv = function(path, bufnr) return 'mp', function(b) -- cgit From 9668c166e88cd71e517cacfb8d266b75047604f7 Mon Sep 17 00:00:00 2001 From: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> Date: Sat, 11 Feb 2023 16:08:33 +0100 Subject: fix(filetype): make vim.filetype.match() work with contents only (#22181) Co-authored-by: Gregory Anders --- runtime/lua/vim/filetype.lua | 95 ++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 47 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 1f605b72f3..ec568b5b82 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2449,6 +2449,7 @@ local function match_pattern(name, path, tail, pat) return false end end + -- If the pattern contains a / match against the full path, otherwise just the tail local fullpat = '^' .. pat .. '$' local matches @@ -2526,64 +2527,64 @@ function M.match(args) name = api.nvim_buf_get_name(bufnr) end - if name then - name = normalize_path(name) - end - local ft, on_detect - -- First check for the simple case where the full path exists as a key - local path = vim.fn.fnamemodify(name, ':p') - ft, on_detect = dispatch(filename[path], path, bufnr) - if ft then - return ft, on_detect - end + if name then + name = normalize_path(name) - -- Next check against just the file name - local tail = vim.fn.fnamemodify(name, ':t') - ft, on_detect = dispatch(filename[tail], path, bufnr) - if ft then - return ft, on_detect - end + -- First check for the simple case where the full path exists as a key + local path = vim.fn.fnamemodify(name, ':p') + ft, on_detect = dispatch(filename[path], path, bufnr) + if ft then + return ft, on_detect + end - -- Next, check the file path against available patterns with non-negative priority - local j = 1 - for i, v in ipairs(pattern_sorted) do - local k = next(v) - local opts = v[k][2] - if opts.priority < 0 then - j = i - break + -- Next check against just the file name + local tail = vim.fn.fnamemodify(name, ':t') + ft, on_detect = dispatch(filename[tail], path, bufnr) + if ft then + return ft, on_detect end - local filetype = v[k][1] - local matches = match_pattern(name, path, tail, k) - if matches then - ft, on_detect = dispatch(filetype, path, bufnr, matches) - if ft then - return ft, on_detect + -- Next, check the file path against available patterns with non-negative priority + local j = 1 + for i, v in ipairs(pattern_sorted) do + local k = next(v) + local opts = v[k][2] + if opts.priority < 0 then + j = i + break + end + + local filetype = v[k][1] + local matches = match_pattern(name, path, tail, k) + if matches then + ft, on_detect = dispatch(filetype, path, bufnr, matches) + if ft then + return ft, on_detect + end end end - end - -- Next, check file extension - local ext = vim.fn.fnamemodify(name, ':e') - ft, on_detect = dispatch(extension[ext], path, bufnr) - if ft then - return ft, on_detect - end + -- Next, check file extension + local ext = vim.fn.fnamemodify(name, ':e') + ft, on_detect = dispatch(extension[ext], path, bufnr) + if ft then + return ft, on_detect + end - -- Next, check patterns with negative priority - for i = j, #pattern_sorted do - local v = pattern_sorted[i] - local k = next(v) + -- Next, check patterns with negative priority + for i = j, #pattern_sorted do + local v = pattern_sorted[i] + local k = next(v) - local filetype = v[k][1] - local matches = match_pattern(name, path, tail, k) - if matches then - ft, on_detect = dispatch(filetype, path, bufnr, matches) - if ft then - return ft, on_detect + local filetype = v[k][1] + local matches = match_pattern(name, path, tail, k) + if matches then + ft, on_detect = dispatch(filetype, path, bufnr, matches) + if ft then + return ft, on_detect + end end end end -- cgit From b518aceaa8f738e581e58aacae93514699b5ff8e Mon Sep 17 00:00:00 2001 From: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> Date: Tue, 14 Feb 2023 00:04:16 +0100 Subject: feat(filetype): fall back to file extension when matching from hashbang (#22140) If nothing matched in match_from_hashbang, also check the file extension table. For a hashbang like '#!/bin/env foo', this will set the filetype to 'fooscript' assuming the filetype for the 'foo' extension is 'fooscript' in the extension table. --- runtime/lua/vim/filetype.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index ec568b5b82..ca91f3f402 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2604,7 +2604,9 @@ function M.match(args) -- If the function tries to use the filename that is nil then it will fail, -- but this enables checks which do not need a filename to still work. local ok - ok, ft = pcall(require('vim.filetype.detect').match_contents, contents, name) + ok, ft = pcall(require('vim.filetype.detect').match_contents, contents, name, function(ext) + return dispatch(extension[ext], name, bufnr) + end) if ok and ft then return ft end -- cgit From 2f6413797499a1bdac28c20a491e8ea3be33bda3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 19 Feb 2023 01:27:32 +0100 Subject: vim-patch:9.0.1319: PRQL files are not recognized (#22319) Problem: PRQL files are not recognized. Solution: Add a filetype pattern for PRQL files. (Matthias Queitsch, closes vim/vim#12018) https://github.com/vim/vim/commit/9de960ace0f017fcfeaf64a2f6492f0f88b11fdb Co-authored-by: Matthias Queitsch --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index ca91f3f402..4ee7d46b20 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -810,6 +810,7 @@ local extension = { pdb = 'prolog', pml = 'promela', proto = 'proto', + prql = 'prql', ['psd1'] = 'ps1', ['psm1'] = 'ps1', ['ps1'] = 'ps1', -- cgit From d1b34b74580fc09d86144c35e24a1a8a0d531b36 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 22 Feb 2023 10:58:15 +0100 Subject: vim-patch:9.0.1337: yuck files are not recognized (#22358) Problem: Yuck files are not recognized. Solution: Add a filetype pattern for yuck files. (Amaan Qureshi, closes vim/vim#12033) https://github.com/vim/vim/commit/cfce5cf542db20c7beba5b4211c0ae3305a64a43 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 4ee7d46b20..0dd2dcfcbe 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1131,6 +1131,7 @@ local extension = { yml = 'yaml', yaml = 'yaml', yang = 'yang', + yuck = 'yuck', ['z8a'] = 'z8a', zig = 'zig', zir = 'zir', -- cgit From 8c339aa04b2a1ca99a297b2eada8ebc6218f5f1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 23 Feb 2023 17:52:33 +0100 Subject: vim-patch:9.0.1346: Starlark files are not recognized (#22380) Problem: Starlark files are not recognized. Solution: Add patterns for Starlark files. (Amaan Qureshi, closes vim/vim#12049) https://github.com/vim/vim/commit/ca06b30073de22dc120b532e90fbee2a10ef9772 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 0dd2dcfcbe..ae3ad6f628 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -995,6 +995,9 @@ local extension = { ssa = 'ssa', ass = 'ssa', st = 'st', + ipd = 'starlark', + star = 'starlark', + starlark = 'starlark', imata = 'stata', ['do'] = 'stata', mata = 'stata', -- cgit From 5e1308b7caa89b458cc97d2db956379aa54ed68a Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 23 Feb 2023 16:12:01 -0500 Subject: vim-patch:9.0.1348: Un-grammar files are not recognized (#22383) Problem: Un-grammar files are not recognized. Solution: Add patterns for Un-grammar files. (Amaan Qureshi, closes vim/vim#12034) https://github.com/vim/vim/commit/44e08c1cf83f5a50f8b21613551304a6651c1161 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index ae3ad6f628..3a68b61914 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1056,6 +1056,7 @@ local extension = { uc = 'uc', uit = 'uil', uil = 'uil', + ungram = 'ungrammar', sba = 'vb', vb = 'vb', dsm = 'vb', -- cgit From 4297127f14fa1b9062db7de0d63981887ebed063 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Feb 2023 15:34:52 +0100 Subject: vim-patch:9.0.1350: CPON files are not recognized (#22392) Problem: CPON files are not recognized. Solution: Add patterns for CPON files. (Amaan Qureshi, closes vim/vim#12053) https://github.com/vim/vim/commit/c2254764bcada43eea894eb5852a26d5ac5ca8b0 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 3a68b61914..5475f09444 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -242,6 +242,7 @@ local extension = { csh = function(path, bufnr) return require('vim.filetype.detect').csh(path, bufnr) end, + cpon = 'cpon', moc = 'cpp', hh = 'cpp', tlh = 'cpp', -- cgit From 15cce77b383d0b0bfdaa1415cdde005cc43267d0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Feb 2023 17:50:37 +0100 Subject: vim-patch:9.0.1351: Dhall files are not recognized (#22393) Problem: Dhall files are not recognized. Solution: Add patterns for Dhall files. (Amaan Qureshi, closes vim/vim#12052) https://github.com/vim/vim/commit/def5521752abefe12db8cc3111a3b205ad1ac929 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 5475f09444..a4e078fd04 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -296,6 +296,7 @@ local extension = { desc = 'desc', directory = 'desktop', desktop = 'desktop', + dhall = 'dhall', diff = 'diff', rej = 'diff', Dockerfile = 'dockerfile', -- cgit From 2a8e6a2f1a8e047a8efd84764d9a332bbd6ae96d Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 27 Feb 2023 15:08:31 -0500 Subject: vim-patch:9.0.1360: Cue files are not recognized (#22439) Problem: Cue files are not recognized. Solution: Add patterns for Cue files. (Amaan Qureshi, closes vim/vim#12067) https://github.com/vim/vim/commit/80c5b2c0f78b24e52c73bb162dda3ad85acd7e82 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index a4e078fd04..256c053801 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -276,6 +276,7 @@ local extension = { feature = 'cucumber', cuh = 'cuda', cu = 'cuda', + cue = 'cue', pld = 'cupl', si = 'cuplsim', cyn = 'cynpp', -- cgit From fdb6b4d2e729211f0526ce75c6a3fcc636859bfd Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 2 Mar 2023 17:29:03 -0500 Subject: vim-patch:9.0.1368: Bass files are not recognized (#22485) Problem: Bass files are not recognized. Solution: Add patterns for Bass files. (Amaan Qureshi, closes vim/vim#12088) https://github.com/vim/vim/commit/4ed914b18a47192f79f342bea5e8f59e120d5260 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 256c053801..8911eafc71 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -156,6 +156,7 @@ local extension = { bas = function(path, bufnr) return require('vim.filetype.detect').bas(bufnr) end, + bass = 'bass', bi = function(path, bufnr) return require('vim.filetype.detect').bas(bufnr) end, -- cgit From 6a20c29dcd050fee011ec1c451b5e70940152885 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:05:01 +0900 Subject: docs(filetype): number → integer (#22516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/lua/vim/filetype.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 8911eafc71..65579d3543 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -28,9 +28,9 @@ end --- If only start_lnum is specified, return a single line as a string. --- If both start_lnum and end_lnum are omitted, return all lines from the buffer. --- ----@param bufnr number|nil The buffer to get the lines from ----@param start_lnum number|nil The line number of the first line (inclusive, 1-based) ----@param end_lnum number|nil The line number of the last line (inclusive, 1-based) +---@param bufnr integer|nil The buffer to get the lines from +---@param start_lnum integer|nil The line number of the first line (inclusive, 1-based) +---@param end_lnum integer|nil The line number of the last line (inclusive, 1-based) ---@return table|string Array of lines, or string when end_lnum is omitted function M.getlines(bufnr, start_lnum, end_lnum) if end_lnum then @@ -67,8 +67,8 @@ end ---@private --- Get the next non-whitespace line in the buffer. --- ----@param bufnr number The buffer to get the line from ----@param start_lnum number The line number of the first line to start from (inclusive, 1-based) +---@param bufnr integer The buffer to get the line from +---@param start_lnum integer The line number of the first line to start from (inclusive, 1-based) ---@return string|nil The first non-blank line if found or `nil` otherwise function M.nextnonblank(bufnr, start_lnum) for _, line in ipairs(M.getlines(bufnr, start_lnum, -1)) do -- cgit From 6dd9770baf16abfedba667e93d92899602864645 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Wed, 8 Mar 2023 18:19:10 -0500 Subject: vim-patch:9.0.1394: Unx Tal files are not recognized (#22579) Problem: Unx Tal files are not recognized. Solution: Add a pattern for Unx Tal files. (Amaan Qureshi, closes vim/vim#12117) https://github.com/vim/vim/commit/cde1f8714ed2c046aa770c46229e781380122bd7 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 65579d3543..33324f580a 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1015,6 +1015,7 @@ local extension = { svh = 'systemverilog', sv = 'systemverilog', tak = 'tak', + tal = 'tal', task = 'taskedit', tm = 'tcl', tcl = 'tcl', -- cgit From ae70e946eeaec792c9a87a89fea7141b5ee6a33c Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Wed, 8 Mar 2023 18:19:18 -0500 Subject: vim-patch:9.0.1395: Odin files are not recognized (#22580) Problem: Odin files are not recognized. Solution: Add a pattern for Odin files. (Amaan Qureshi, closes vim/vim#12122) https://github.com/vim/vim/commit/638388b8ef37684e36a7f5d9286bab2d31c28f36 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 33324f580a..8238fec2cc 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -751,6 +751,7 @@ local extension = { mli = 'ocaml', ml = 'ocaml', occ = 'occam', + odin = 'odin', xom = 'omnimark', xin = 'omnimark', opam = 'opam', -- cgit From 68aa2857dd6bc1b33add02121cd36ef1ab32728c Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 9 Mar 2023 12:13:44 -0500 Subject: vim-patch:9.0.1393: Cairo files are not recognized (#22578) Problem: Cairo files are not recognized. Solution: Add a pattern for Cairo files. (Amaan Qureshi, closes vim/vim#12118) https://github.com/vim/vim/commit/ff226d49fed2d8fc668084324c7b0f00117c5e74 --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 8238fec2cc..1732623223 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -191,6 +191,7 @@ local extension = { BUILD = 'bzl', qc = 'c', cabal = 'cabal', + cairo = 'cairo', capnp = 'capnp', cdc = 'cdc', cdl = 'cdl', -- cgit From 43d33c5d1abb7ed58237cb5e59d6e1e7dd046b55 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Mar 2023 09:40:25 +0100 Subject: vim-patch:9.0.1406: ILE RPG files are not recognized Problem: ILE RPG files are not recognized. Solution: Add patterns for ILE RPG files. (Andreas Louv, issue vim/vim#12152) https://github.com/vim/vim/commit/e202ec8a0c89e8ef47a3d38e668b7326fa68510a Co-authored-by: Andreas Louv --- runtime/lua/vim/filetype.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 1732623223..7be4b75138 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -883,6 +883,8 @@ local extension = { ron = 'ron', rsc = 'routeros', x = 'rpcgen', + rpgle = 'rpgle', + rpgleinc = 'rpgle', rpl = 'rpl', Srst = 'rrst', srst = 'rrst', -- cgit From d7746b6ef1dcb64b3fc4ba744eafc69780772e26 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Mar 2023 09:41:19 +0100 Subject: vim-patch:9.0.1407: TableGen files are not recognized Problem: TableGen files are not recognized. Solution: Add a pattern for TableGen files. (Amaan Qureshi, closes vim/vim#12156) https://github.com/vim/vim/commit/b8ef029ee416fc2b402c3f321a55c9049b0ad2a9 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 7be4b75138..9eb03c776a 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1018,6 +1018,7 @@ local extension = { swift = 'swift', svh = 'systemverilog', sv = 'systemverilog', + td = 'tablegen', tak = 'tak', tal = 'tal', task = 'taskedit', -- cgit From f83d8ea2798c87e441801ce5f08291808bf6ddbc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Mar 2023 09:42:01 +0100 Subject: vim-patch:9.0.1408: QMLdir files are not recognized Problem: QMLdir files are not recognized. Solution: Add a pattern for QMLdir files. (Amaan Qureshi, closes vim/vim#12161) https://github.com/vim/vim/commit/1505bef5c482a48e704644e6172be91c07ef1d12 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 9eb03c776a..f5353b853d 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1593,6 +1593,7 @@ local filename = { ['.pythonstartup'] = 'python', ['.pythonrc'] = 'python', SConstruct = 'python', + qmldir = 'qmldir', ['.Rprofile'] = 'r', ['Rprofile'] = 'r', ['Rprofile.site'] = 'r', -- cgit From 571b50be16a0bb859082196ac1a80872526314cb Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Mar 2023 09:42:33 +0100 Subject: vim-patch:9.0.1409: racket files are recognized as scheme Problem: Racket files are recognized as scheme. Solution: Recognize rackets files separately. (Gabriel Kakizaki, closes vim/vim#12164, closes vim/vim#12162) https://github.com/vim/vim/commit/d11ac403db07b6eac43882485e98caeb5e83e2e5 Co-authored-by: Gabriel Kakizaki --- runtime/lua/vim/filetype.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index f5353b853d..b777eaa179 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -838,6 +838,9 @@ local extension = { R = function(path, bufnr) return require('vim.filetype.detect').r(bufnr) end, + rkt = 'racket', + rktd = 'racket', + rktl = 'racket', rad = 'radiance', mat = 'radiance', ['pod6'] = 'raku', @@ -910,9 +913,6 @@ local extension = { ss = 'scheme', scm = 'scheme', sld = 'scheme', - rkt = 'scheme', - rktd = 'scheme', - rktl = 'scheme', sce = 'scilab', sci = 'scilab', scss = 'scss', -- cgit From 66ba81a6f7b52c0a765fc52362ca8f730af487ab Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 18 Mar 2023 05:34:31 -0400 Subject: vim-patch:9.0.1412: Pony files are not recognized (#22721) Problem: Pony files are not recognized. Solution: Add a pattern for Pony files. (Amaan Qureshi, closes vim/vim#12155) https://github.com/vim/vim/commit/6e377eca8de4c0c0d25808beb7de7676194ebf1d --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index b777eaa179..cf813b19b1 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -800,6 +800,7 @@ local extension = { pod = 'pod', filter = 'poefilter', pk = 'poke', + pony = 'pony', ps = 'postscr', epsi = 'postscr', afm = 'postscr', -- cgit From e5641df6d3fc3bb6c3c55593b6152082bfc561b6 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sat, 11 Mar 2023 17:11:02 +0000 Subject: feat: add `vim.filetype.get_option()` --- runtime/lua/vim/filetype.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index cf813b19b1..69fcb01e8c 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2631,4 +2631,24 @@ function M.match(args) end end +--- Get the default option value for a {filetype}. +--- +--- The returned value is what would be set in a new buffer after 'filetype' +--- is set, meaning it should respect all FileType autocmds and ftplugin files. +--- +--- Example: +---
lua
+---   vim.filetype.get_option('vim', 'commentstring')
+--- 
+--- +--- Note: this uses |nvim_get_option_value()| but caches the result. +--- This means |ftplugin| and |FileType| autocommands are only +--- triggered once and may not reflect later changes. +--- @param filetype string Filetype +--- @param option string Option name +--- @return string|boolean|integer: Option value +function M.get_option(filetype, option) + return require('vim.filetype.options').get_option(filetype, option) +end + return M -- cgit From d11986171b4a5ddd950053e2b9a26d2ad8e89a5c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 20 Mar 2023 21:07:09 +0100 Subject: vim-patch:9.0.1415: Crystal files are not recognized Problem: Crystal files are not recognized. Solution: Add a pattern for Crystal files. (Amaan Qureshi, closes vim/vim#12175) https://github.com/vim/vim/commit/7c4516fe93d865f4ef1877181f8156b8b9331856 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 69fcb01e8c..399760b254 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -265,6 +265,7 @@ local extension = { end, cql = 'cqlang', crm = 'crm', + cr = 'crystal', csx = 'cs', cs = 'cs', csc = 'csc', -- cgit From 0c9ed19af3be45d679d77460dd5f6833752f9f56 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 20 Mar 2023 21:07:55 +0100 Subject: vim-patch:9.0.1417: ESDL files are not recognized Problem: ESDL files are not recognized. Solution: Add a pattern for ESDL files. (Amaan Qureshi, closes vim/vim#12174) https://github.com/vim/vim/commit/a1fa8b3ac2f7b54c7901ad3eb0ba8b8290912509 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 399760b254..5127474765 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -350,6 +350,7 @@ local extension = { yaws = 'erlang', erb = 'eruby', rhtml = 'eruby', + esdl = 'esdl', ec = 'esqlc', EC = 'esqlc', strl = 'esterel', -- cgit From 48ce2ef912cbbe43b85b45a8a97f8d240318718a Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Wed, 22 Mar 2023 04:19:56 -0400 Subject: vim-patch:9.0.{1419,1421,1422,1423}: some files are not recognized (#22749) vim-patch:9.0.1419: Lean files are not recognized Problem: Lean files are not recognized. Solution: Add a pattern for Lean files. (Amaan Qureshi, closes vim/vim#12177) https://github.com/vim/vim/commit/4a5c39fc52a73d46ac77cf574f765a465befc3c0 vim-patch:9.0.1421: Nu files are not recognized Problem: Nu files are not recognized. Solution: Add a pattern for Nu files. (Amaan Qureshi, closes vim/vim#12172) https://github.com/vim/vim/commit/8aa2a37f8983a7863afa32d9ffbe64b2f2bc70be vim-patch:9.0.1422: Sage files are not recognized Problem: Sage files are not recognized. Solution: Add a pattern for Sage files. (Amaan Qureshi, closes vim/vim#12176) https://github.com/vim/vim/commit/d0639d717ba7cf8b04b588aadd0b379ed43a5f1f vim-patch:9.0.1423: WebAssembly Interface Type files are not recognized Problem: WebAssembly Interface Type files are not recognized. Solution: Add a pattern for WIT files. (Amaan Qureshi, closes vim/vim#12173) https://github.com/vim/vim/commit/890c77203637626b1005db818667084d11e653e7 --- runtime/lua/vim/filetype.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 5127474765..fa4208e2a4 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -593,6 +593,7 @@ local extension = { lte = 'latte', ld = 'ld', ldif = 'ldif', + lean = 'lean', journal = 'ledger', ldg = 'ledger', ledger = 'ledger', @@ -908,6 +909,7 @@ local extension = { builder = 'ruby', rake = 'ruby', rs = 'rust', + sage = 'sage', sas = 'sas', sass = 'sass', sa = 'sather', @@ -1106,6 +1108,7 @@ local extension = { wdl = 'wdl', wm = 'webmacro', wbt = 'winbatch', + wit = 'wit', wml = 'wml', wsml = 'wsml', ad = 'xdefaults', @@ -1543,6 +1546,8 @@ local filename = { NEWS = function(path, bufnr) return require('vim.filetype.detect').news(bufnr) end, + ['env.nu'] = 'nu', + ['config.nu'] = 'nu', ['.ocamlinit'] = 'ocaml', ['.octaverc'] = 'octave', octaverc = 'octave', -- cgit From ee5008f8789f61a3b153220abb870dd49427e52c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Mar 2023 14:06:04 +0100 Subject: vim-patch:9.0.1425: "wat" and "wast" files are one filetype (#22774) Problem: "wat" and "wast" files are one filetype. Solution: Add a separate filetype for "wat" files. (Amaan Qureshi, closes vim/vim#12165) https://github.com/vim/vim/commit/3ea62381c527395ae701715335776f427d22eb7b Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index fa4208e2a4..740304df15 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1103,8 +1103,8 @@ local extension = { wrl = 'vrml', vroom = 'vroom', vue = 'vue', - wat = 'wast', wast = 'wast', + wat = 'wat', wdl = 'wdl', wm = 'webmacro', wbt = 'winbatch', -- cgit From 196f69909db9e44477731cd805dac119a54725c2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 29 Mar 2023 10:23:52 +0200 Subject: vim-patch:9.0.1430: Livebook files are not recognized (#22808) Problem: Livebook files are not recognized. Solution: Add a pattern for Livebook files. (Mathias Jean Johansen, closes vim/vim#12203) https://github.com/vim/vim/commit/64002035178ac3e0d9ab7269d1bf06c6ede5a854 Co-authored-by: Mathias Jean Johansen --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 740304df15..87439f9f0c 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -615,6 +615,7 @@ local extension = { asd = 'lisp', lt = 'lite', lite = 'lite', + livemd = 'livebook', lgt = 'logtalk', lotos = 'lotos', lot = 'lotos', -- cgit From d9e9dc3a06b78d3d1548757348788454f62ea3dc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 16 Apr 2023 10:59:04 +0200 Subject: vim-patch:9.0.1455: C++ 20 modules are not recognized (#23124) Problem: C++ 20 modules are not recognized. Solution: Add patterns to recognize C++ 20 modules as "cpp". (Ben Jackson, closes vim/vim#12261) https://github.com/vim/vim/commit/732d69e1918b28ad0fe16eb9bc5a776c7958122b Co-authored-by: Ben Jackson --- runtime/lua/vim/filetype.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 87439f9f0c..74ab7d8260 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -257,6 +257,10 @@ local extension = { tcc = 'cpp', hxx = 'cpp', hpp = 'cpp', + ccm = 'cpp', + cppm = 'cpp', + cxxm = 'cpp', + ['c++m'] = 'cpp', cpp = function(path, bufnr) return vim.g.cynlib_syntax_for_cpp and 'cynlib' or 'cpp' end, -- cgit From cff02e993d920fa4bf0b5dc8b8f12d979850f049 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 19 Apr 2023 10:19:33 +0200 Subject: vim-patch:9.0.1467: Jenkinsfiles are not recognized as groovy (#23195) Problem: Jenkinsfiles are not recognized as groovy. Solution: Add a pattern for Jenkinsfiles. (closes vim/vim#12236) https://github.com/vim/vim/commit/142ffb024dd5123090c2fd02f55702e76520f1df Co-authored-by: dundargoc --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 74ab7d8260..6cfe6e6c35 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1469,6 +1469,7 @@ local filename = { ['.gprc'] = 'gp', ['/.gnupg/gpg.conf'] = 'gpg', ['/.gnupg/options'] = 'gpg', + ['Jenkinsfile'] = 'groovy', ['/var/backups/gshadow.bak'] = 'group', ['/etc/gshadow'] = 'group', ['/etc/group-'] = 'group', -- cgit From 1cb46abff1e903e999105b244329f22678ba8a30 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 22 Apr 2023 23:51:53 +0800 Subject: vim-patch:9.0.1475: busted configuration files are not recognized (#23266) Problem: Busted configuration files are not recognized. Solution: Recognize busted configuration files as Lua. (Craig MacEachern, closes vim/vim#12209) Co-authored-by: C.D. MacEachern --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 6cfe6e6c35..cbd9aa640b 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1522,6 +1522,7 @@ local filename = { ['.lsl'] = function(path, bufnr) return require('vim.filetype.detect').lsl(bufnr) end, + ['.busted'] = 'lua', ['.luacheckrc'] = 'lua', ['lynx.cfg'] = 'lynx', ['m3overrides'] = 'm3build', -- cgit From f17bb4f41102ecec7989bc4c14c626dc595e2f0b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 23 Apr 2023 14:15:52 +0200 Subject: vim-patch:9.0.1478: filetypes for *.v files not detected properly (#23282) * vim-patch:9.0.1478: filetypes for *.v files not detected properly Problem: Filetypes for *.v files not detected properly. Solution: Use the file contents to detect the filetype. (Turiiya, closes vim/vim#12281) https://github.com/vim/vim/commit/80406c26188219f3773b2e9c49160caeeb386ee2 Co-authored-by: Turiiya <34311583+tobealive@users.noreply.github.com> Co-authored-by: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> --- runtime/lua/vim/filetype.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index cbd9aa640b..4fafc4e2e2 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1091,7 +1091,9 @@ local extension = { vr = 'vera', vri = 'vera', vrh = 'vera', - v = 'verilog', + v = function(path, bufnr) + return require('vim.filetype.detect').v(bufnr) + end, va = 'verilogams', vams = 'verilogams', vhdl = 'vhdl', -- cgit From 37dd818722c50a5dbe0771a88a1cdaf98d9596b5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 1 May 2023 10:55:51 +0200 Subject: vim-patch:9.0.1503: Luau files are not recognized (#23412) Problem: Luau files are not recognized. Solution: Add a patter for Luau files. (Amaan Qureshi, closes vim/vim#12317) https://github.com/vim/vim/commit/2dcfe9ae1df61e1249520ed435dd8cf60e157103 Co-authored-by: Amaan Qureshi --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 4fafc4e2e2..5c799b23f2 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -637,6 +637,7 @@ local extension = { nse = 'lua', rockspec = 'lua', lua = 'lua', + luau = 'luau', lrc = 'lyrics', m = function(path, bufnr) return require('vim.filetype.detect').m(bufnr) -- cgit From e90b506903babc84f8c5b796c3b25c7f20e183d2 Mon Sep 17 00:00:00 2001 From: Gaétan Lepage <33058747+GaetanLepage@users.noreply.github.com> Date: Thu, 11 May 2023 09:43:02 +0200 Subject: vim-patch:9.0.1539: typst filetype is not recognized (#23578) Problem: Typst filetype is not recognized. Solution: Distinguish between sql and typst. (Gaetan Lepage, closes vim/vim#12363) https://github.com/vim/vim/commit/4ce1bda869e4ec0152d7dcbe1e491ceac5341d5e --- runtime/lua/vim/filetype.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 5c799b23f2..c746eef1bb 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -997,7 +997,9 @@ local extension = { spi = 'spyce', spy = 'spyce', tyc = 'sql', - typ = 'sql', + typ = function(path, bufnr) + return require('vim.filetype.detect').typ(bufnr) + end, pkb = 'sql', tyb = 'sql', pks = 'sql', -- cgit From 6f29c68928c3f20d9a1b1a7a311cfac65aa1b4e6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 13 May 2023 15:00:08 +0200 Subject: vim-patch:9.0.1549: USD filetype is not recognized (#23608) Problem: USD filetype is not recognized. Solution: Add patterns for USD filetype. (Colin Kennedy, closes vim/vim#12370) https://github.com/vim/vim/commit/b848ce6b7e27f24aff47a4d63933e0f96663acfe Co-authored-by: Colin Kennedy --- runtime/lua/vim/filetype.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index c746eef1bb..5075c18976 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1080,6 +1080,8 @@ local extension = { uit = 'uil', uil = 'uil', ungram = 'ungrammar', + usd = 'usd', + usda = 'usd', sba = 'vb', vb = 'vb', dsm = 'vb', -- cgit From 201f366b370a9df724258b3c9bf01ffaadb8dd01 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 19 May 2023 09:11:22 +0200 Subject: vim-patch:9.0.1565: json lines files are not recognized (#23677) Problem: Json lines files are not recognized. Solution: Add a pattern to detect "jsonl" files. (issue vim/vim#7520) https://github.com/vim/vim/commit/6fadbc1e8c1f4c5b03eb6a78aeb023ca2c2a9a7d Co-authored-by: Bram Moolenaar --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 5075c18976..1b04666161 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -579,6 +579,7 @@ local extension = { ['json-patch'] = 'json', json5 = 'json5', jsonc = 'jsonc', + jsonl = 'jsonl', jsonnet = 'jsonnet', libsonnet = 'jsonnet', jsp = 'jsp', -- cgit From 8e17054a2333318340f23abd7a94abfe474fb52f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 May 2023 11:47:07 +0200 Subject: vim-patch:9.0.1584: not all meson files are recognized (#23797) Problem: Not all meson files are recognized. Solution: Add "meson.options". (Liam Beguin, closes vim/vim#12444) https://github.com/vim/vim/commit/1ba0b9e36f36926a7675b31efeda7d3e495c9157 Co-authored-by: Bram Moolenaar --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 1b04666161..57df621153 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1547,6 +1547,7 @@ local filename = { ['man.config'] = 'manconf', ['maxima-init.mac'] = 'maxima', ['meson.build'] = 'meson', + ['meson.options'] = 'meson', ['meson_options.txt'] = 'meson', ['/etc/conf.modules'] = 'modconf', ['/etc/modules'] = 'modconf', -- cgit From b8a2220f5eb32ead6b66f7c49b7e915883bf3539 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 29 May 2023 10:25:05 +0200 Subject: vim-patch:9.0.1587: Corn config files are not recognized (#23807) Problem: Corn config files are not recognized. Solution: Add a pattern for Corn config files. (Jake Stanger, closes vim/vim#12449) https://github.com/vim/vim/commit/05843e89601c03389a2d7978e7e16aec641a3dc4 Co-authored-by: Jake Stanger --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 57df621153..6990de3391 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -241,6 +241,7 @@ local extension = { copyright = function(path, bufnr) return require('vim.filetype.detect').copyright(bufnr) end, + corn = 'corn', csh = function(path, bufnr) return require('vim.filetype.detect').csh(path, bufnr) end, -- cgit From 0329f5c2f4f300b9ffe66b0b4b2db1d51c6293d1 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 7 Jun 2023 20:53:02 +0200 Subject: vim-patch:9.0.1615: URL shortcut files are not recognized (#23950) Problem: URL shortcut files are not recognized. Solution: Add a pattern for URL shortcut files. (closes vim/vim#12474) https://github.com/vim/vim/commit/cdb7b4c50826df254d2e5ba8abd211e49b7a9784 Co-authored-by: ObserverOfTime --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 6990de3391..13d3d3e53a 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1082,6 +1082,7 @@ local extension = { uit = 'uil', uil = 'uil', ungram = 'ungrammar', + url = 'urlshortcut', usd = 'usd', usda = 'usd', sba = 'vb', -- cgit From be539f5fa8e2d7ad73f7f69941bd6ff13354e89c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 8 Jun 2023 21:53:16 +0200 Subject: vim-patch:9.0.1618: Trace32 files are not recognized (#23960) Problem: Trace32 files are not recognized. Solution: Add patterns for the t32 filetype. (Christoph Sax, closes vim/vim#12505) https://github.com/vim/vim/commit/7fbcee6f928356f1c205a4dfa67c1d542f743b92 Co-authored-by: Christoph Sax --- runtime/lua/vim/filetype.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 13d3d3e53a..18c47ea2f4 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1033,6 +1033,8 @@ local extension = { swift = 'swift', svh = 'systemverilog', sv = 'systemverilog', + cmm = 't32', + t32 = 't32', td = 'tablegen', tak = 'tak', tal = 'tal', -- cgit From 5959b3c9222629c0e6020672ad5b13d0ed707c99 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 9 Jun 2023 23:48:31 +0200 Subject: vim-patch:9.0.1622: filetype name t32 is a bit obscure (#23967) Problem: Filetype name t32 is a bit obscure. Solution: Rename t32 to trace32. (Christoph Sax, closes vim/vim#12512) https://github.com/vim/vim/commit/740df76c90ee2c421ab7852b7ff2835aa0af782a Co-authored-by: Christoph Sax --- runtime/lua/vim/filetype.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 18c47ea2f4..fc8871f593 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1033,8 +1033,8 @@ local extension = { swift = 'swift', svh = 'systemverilog', sv = 'systemverilog', - cmm = 't32', - t32 = 't32', + cmm = 'trace32', + t32 = 'trace32', td = 'tablegen', tak = 'tak', tal = 'tal', -- cgit From 904ad5458de095fec563fb9180fed2c4c87331e1 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 22 Jun 2023 19:38:49 +0200 Subject: vim-patch:9.0.1645: zserio files are not recognized (#24120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: zserio files are not recognized. Solution: Add a pattern for zserio files. (Dominique Pellé, closes vim/vim#12544) https://github.com/vim/vim/commit/2b994da57a0ac6ec0ec09fe3783f48ecd2bce610 Co-authored-by: =?UTF-8?q?Dominique=20Pell=C3=A9?= --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index fc8871f593..08a042d376 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1174,6 +1174,7 @@ local extension = { zir = 'zir', zu = 'zimbu', zut = 'zimbutempl', + zs = 'zserio', zsh = 'zsh', vala = 'vala', web = function(path, bufnr) -- cgit From fdf5013e218c55ca8f9bdb7cf5f16f8596330ea2 Mon Sep 17 00:00:00 2001 From: smjonas Date: Wed, 21 Jun 2023 07:12:53 +0200 Subject: fix(filetype): correctly detect bash-fc-{id} files as "sh" --- runtime/lua/vim/filetype.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index fc8871f593..91d5dc1c62 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2188,7 +2188,7 @@ local pattern = { ['.*/etc/profile'] = function(path, bufnr) return require('vim.filetype.detect').sh(path, M.getlines(bufnr)) end, - ['bash%-fc[%-%.]'] = function(path, bufnr) + ['bash%-fc[%-%.].*'] = function(path, bufnr) return require('vim.filetype.detect').sh(path, M.getlines(bufnr), 'bash') end, ['%.tcshrc.*'] = function(path, bufnr) -- cgit From cc624fac683ce6dbd01f10781817cd654cceed38 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 24 Jun 2023 20:04:30 +0200 Subject: vim-patch:9.0.1661: BUCK files are not recognized (#24142) Problem: BUCK files are not recognized. Solution: Recognize BUCK files as "bzl". (Son Luong Ngoc, closes vim/vim#12564) https://github.com/vim/vim/commit/b46e0f3263acd99c61df06ee3c4d1f6e0b471bc3 Co-authored-by: Son Luong Ngoc --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 33e80690ff..7bcc67313d 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1372,6 +1372,7 @@ local filename = { ['named.root'] = 'bindzone', WORKSPACE = 'bzl', ['WORKSPACE.bzlmod'] = 'bzl', + BUCK = 'bzl', BUILD = 'bzl', ['cabal.project'] = 'cabalproject', ['cabal.config'] = 'cabalconfig', -- cgit From 0ca2d11c1f473d9924c261c9dbd4e38730932bb4 Mon Sep 17 00:00:00 2001 From: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:19:13 +0200 Subject: vim-patch:9.0.1632: not all cabal config files are recognized (#24025) Problem: Not all cabal config files are recognized. Solution: Add a couple of patterns. (Marcin Szamotulski, closes vim/vim#12463) https://github.com/vim/vim/commit/166cd7b801ebe4aa042a9bbd6007d1951800aaa9 Also: - Do not expand Lua patterns in environment variables used in file patterns. - Test $XDG_CONFIG_HOME on Windows, as it can be used by Nvim (and the runner sets it). Co-authored-by: Marcin Szamotulski --- runtime/lua/vim/filetype.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 7bcc67313d..fc94091622 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1809,6 +1809,8 @@ local pattern = { ['bzr_log%..*'] = 'bzr', ['.*enlightenment/.*%.cfg'] = 'c', ['${HOME}/cabal%.config'] = 'cabalconfig', + ['${HOME}/%.config/cabal/config'] = 'cabalconfig', + ['${XDG_CONFIG_HOME}/cabal/config'] = 'cabalconfig', ['cabal%.project%..*'] = starsetf('cabalproject'), ['.*/%.calendar/.*'] = starsetf('calendar'), ['.*/share/calendar/.*/calendar%..*'] = starsetf('calendar'), @@ -2490,7 +2492,7 @@ local function match_pattern(name, path, tail, pat) return_early = true return nil end - return vim.env[env] + return vim.pesc(vim.env[env]) end) if return_early then return false -- cgit From 8ea9a70d05d6a7f9bab410101a87e6b184f14634 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 27 Jun 2023 10:14:34 +0300 Subject: vim-patch:9.0.1668: PEM files are not recognized (#24169) Problem: PEM files are not recognized. Solution: Add patterns to match PEM files. (closes vim/vim#12582) https://github.com/vim/vim/commit/0256d76a3392aef270b38d1cf7633008e45c2003 --- runtime/lua/vim/filetype.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index fc94091622..bc880ed130 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -783,6 +783,10 @@ local extension = { g = 'pccts', pcmk = 'pcmk', pdf = 'pdf', + pem = 'pem', + cer = 'pem', + crt = 'pem', + csr = 'pem', plx = 'perl', prisma = 'prisma', psgi = 'perl', -- cgit From 766f4978d6cb146511cf0b676c01e5327db46647 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 10 Jul 2023 19:38:15 +0800 Subject: fix(lint): lint warnings #24226 --- runtime/lua/vim/filetype.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index bc880ed130..33d451315d 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -28,7 +28,7 @@ end --- If only start_lnum is specified, return a single line as a string. --- If both start_lnum and end_lnum are omitted, return all lines from the buffer. --- ----@param bufnr integer|nil The buffer to get the lines from +---@param bufnr integer The buffer to get the lines from ---@param start_lnum integer|nil The line number of the first line (inclusive, 1-based) ---@param end_lnum integer|nil The line number of the last line (inclusive, 1-based) ---@return table|string Array of lines, or string when end_lnum is omitted -- cgit From be74807eef13ff8c90d55cf8b22b01d6d33b1641 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 18 Jul 2023 15:42:30 +0100 Subject: docs(lua): more improvements (#24387) * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes --------- Co-authored-by: Justin M. Keyes --- runtime/lua/vim/filetype.lua | 5 ----- 1 file changed, 5 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 33d451315d..40f72a217d 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -2,7 +2,6 @@ local api = vim.api local M = {} ----@private local function starsetf(ft, opts) return { function(path, bufnr) @@ -2317,7 +2316,6 @@ local pattern = { -- luacheck: pop -- luacheck: pop ----@private local function sort_by_priority(t) local sorted = {} for k, v in pairs(t) do @@ -2341,7 +2339,6 @@ end local pattern_sorted = sort_by_priority(pattern) ----@private local function normalize_path(path, as_pattern) local normal = path:gsub('\\', '/') if normal:find('^~') then @@ -2456,7 +2453,6 @@ function M.add(filetypes) end end ----@private local function dispatch(ft, path, bufnr, ...) local on_detect if type(ft) == 'function' then @@ -2483,7 +2479,6 @@ end -- Lookup table/cache for patterns that contain an environment variable pattern, e.g. ${SOME_VAR}. local expand_env_lookup = {} ----@private local function match_pattern(name, path, tail, pat) if expand_env_lookup[pat] == nil then expand_env_lookup[pat] = pat:find('%${') ~= nil -- cgit From ce792db5b806b41d5d687e3b09da9ab2b6be0307 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Mon, 7 Aug 2023 19:44:52 +0300 Subject: vim-patch:9.0.1678: blade files are not recognized (#24601) Problem: Blade files are not recognized. Solution: Add a pattern for Blade files. (closes vim/vim#12650) https://github.com/vim/vim/commit/ad34abee258322826146d597ac5b5fd2111c2b79 Co-authored-by: Bram Moolenaar --- runtime/lua/vim/filetype.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 40f72a217d..66e224ce69 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1809,6 +1809,7 @@ local pattern = { ['.*/build/conf/.*%.conf'] = 'bitbake', ['.*/meta/conf/.*%.conf'] = 'bitbake', ['.*/meta%-.*/conf/.*%.conf'] = 'bitbake', + ['.*%.blade%.php'] = 'blade', ['bzr_log%..*'] = 'bzr', ['.*enlightenment/.*%.cfg'] = 'c', ['${HOME}/cabal%.config'] = 'cabalconfig', -- cgit From c6c21db82b31ea43ce878ab3725dcd901db1e7a1 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 8 Aug 2023 16:36:06 +0100 Subject: fix(filetype): add typing and dry (#24573) --- runtime/lua/vim/filetype.lua | 1205 ++++++++++++++++-------------------------- 1 file changed, 456 insertions(+), 749 deletions(-) (limited to 'runtime/lua/vim/filetype.lua') diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 66e224ce69..a53216f8ea 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1,7 +1,16 @@ local api = vim.api +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.mapping.value string|vim.filetype.mapfn|vim.filetype.maptbl +--- @alias vim.filetype.mapping table + +--- @param ft string|vim.filetype.mapfn +--- @param opts? {priority:integer} +--- @return vim.filetype.maptbl local function starsetf(ft, opts) return { function(path, bufnr) @@ -23,36 +32,38 @@ local function starsetf(ft, opts) end ---@private ---- Get a single line or line range from the buffer. ---- If only start_lnum is specified, return a single line as a string. ---- If both start_lnum and end_lnum are omitted, return all lines from the buffer. ---- +--- Get a line range from the buffer. ---@param bufnr integer The buffer to get the lines from ---@param start_lnum integer|nil The line number of the first line (inclusive, 1-based) ---@param end_lnum integer|nil The line number of the last line (inclusive, 1-based) ----@return table|string Array of lines, or string when end_lnum is omitted -function M.getlines(bufnr, start_lnum, end_lnum) - if end_lnum then - -- Return a line range - return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum, false) - end +---@return string[] # Array of lines +function M._getlines(bufnr, start_lnum, end_lnum) if start_lnum then - -- Return a single line - return api.nvim_buf_get_lines(bufnr, start_lnum - 1, start_lnum, false)[1] or '' - else - -- Return all lines - return api.nvim_buf_get_lines(bufnr, 0, -1, false) + return api.nvim_buf_get_lines(bufnr, start_lnum - 1, end_lnum or start_lnum, false) end + + -- Return all lines + return api.nvim_buf_get_lines(bufnr, 0, -1, false) +end + +---@private +--- Get a single line from the buffer. +---@param bufnr integer The buffer to get the lines from +---@param start_lnum integer The line number of the first line (inclusive, 1-based) +---@return string +function M._getline(bufnr, start_lnum) + -- Return a single line + return api.nvim_buf_get_lines(bufnr, start_lnum - 1, start_lnum, false)[1] or '' end ---@private --- Check whether a string matches any of the given Lua patterns. --- ----@param s string The string to check ----@param patterns table A list of Lua patterns +---@param s string? The string to check +---@param patterns string[] A list of Lua patterns ---@return boolean `true` if s matched a pattern, else `false` -function M.findany(s, patterns) - if s == nil then +function M._findany(s, patterns) + if not s then return false end for _, v in ipairs(patterns) do @@ -69,8 +80,8 @@ end ---@param bufnr integer The buffer to get the line from ---@param start_lnum integer The line number of the first line to start from (inclusive, 1-based) ---@return string|nil The first non-blank line if found or `nil` otherwise -function M.nextnonblank(bufnr, start_lnum) - for _, line in ipairs(M.getlines(bufnr, start_lnum, -1)) do +function M._nextnonblank(bufnr, start_lnum) + for _, line in ipairs(M._getlines(bufnr, start_lnum, -1)) do if not line:find('^%s*$') then return line end @@ -78,30 +89,93 @@ function M.nextnonblank(bufnr, start_lnum) return nil end ----@private ---- Check whether the given string matches the Vim regex pattern. -M.matchregex = (function() - local cache = {} - return function(s, pattern) - if s == nil then - return nil +do + --- @type table + local regex_cache = {} + + ---@private + --- Check whether the given string matches the Vim regex pattern. + --- @param s string? + --- @param pattern string + --- @return boolean + function M._matchregex(s, pattern) + if not s then + return false + end + if not regex_cache[pattern] then + regex_cache[pattern] = vim.regex(pattern) + end + return regex_cache[pattern]:match_str(s) ~= nil + end +end + +--- @module 'vim.filetype.detect' +local detect = setmetatable({}, { + --- @param k string + --- @param t table + --- @return function + __index = function(t, k) + t[k] = function(...) + return require('vim.filetype.detect')[k](...) + end + return t[k] + end, +}) + +--- @param ... string|vim.filetype.mapfn +--- @return vim.filetype.mapfn +local function detect_seq(...) + local candidates = { ... } + return function(...) + for _, c in ipairs(candidates) do + if type(c) == 'string' then + return c + end + if type(c) == 'function' then + local r = c(...) + if r then + return r + end + end end - if not cache[pattern] then - cache[pattern] = vim.regex(pattern) + end +end + +local function detect_noext(path, bufnr) + local root = fn.fnamemodify(path, ':r') + return M.match({ buf = bufnr, filename = root }) +end + +--- @param pat string +--- @param a string? +--- @param b string? +--- @return vim.filetype.mapfn +local function detect_line1(pat, a, b) + return function(_path, bufnr) + if M._getline(bufnr, 1):find(pat) then + return a end - return cache[pattern]:match_str(s) + return b end -end)() +end + +--- @type vim.filetype.mapfn +local detect_rc = function(path, _bufnr) + if not path:find('/etc/Muttrc%.d/') then + return 'rc' + end +end -- luacheck: push no unused args -- luacheck: push ignore 122 -- Filetypes based on file extension ---@diagnostic disable: unused-local +--- @type vim.filetype.mapping local extension