aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/filetype.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
commitc324271b99eee4c621463f368914d57cd729bd9c (patch)
tree5d979d333a2d5f9c080991d5482fd5916f8579c6 /runtime/lua/vim/filetype.lua
parent931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'runtime/lua/vim/filetype.lua')
-rw-r--r--runtime/lua/vim/filetype.lua54
1 files changed, 35 insertions, 19 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index c6200f16bb..fba76f93b2 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -267,6 +267,7 @@ local extension = {
crdpro = 'chordpro',
cho = 'chordpro',
chordpro = 'chordpro',
+ ck = 'chuck',
eni = 'cl',
icl = 'clean',
cljx = 'clojure',
@@ -341,7 +342,7 @@ local extension = {
decl = detect.decl,
dec = detect.decl,
dcl = detect_seq(detect.decl, 'clean'),
- def = 'def',
+ def = detect.def,
desc = 'desc',
directory = 'desktop',
desktop = 'desktop',
@@ -363,6 +364,8 @@ local extension = {
d = detect.dtrace,
dts = 'dts',
dtsi = 'dts',
+ dtso = 'dts',
+ its = 'dts',
dylan = 'dylan',
intr = 'dylanintr',
lid = 'dylanlid',
@@ -674,8 +677,6 @@ local extension = {
mmp = 'mmp',
mms = detect.mms,
DEF = 'modula2',
- m2 = 'modula2',
- mi = 'modula2',
lm3 = 'modula3',
mojo = 'mojo',
['🔥'] = 'mojo', -- 🙄
@@ -695,6 +696,7 @@ local extension = {
msql = 'msql',
mu = 'mupad',
mush = 'mush',
+ mustache = 'mustache',
mysql = 'mysql',
n1ql = 'n1ql',
nql = 'n1ql',
@@ -908,6 +910,7 @@ local extension = {
sed = 'sed',
sexp = 'sexplib',
bash = detect.bash,
+ bats = detect.bash,
ebuild = detect.bash,
eclass = detect.bash,
env = detect.sh,
@@ -1341,10 +1344,12 @@ local filename = {
['.hintrc'] = 'jsonc',
['.jsfmtrc'] = 'jsonc',
['.jshintrc'] = 'jsonc',
+ ['.luaurc'] = 'jsonc',
['.swrc'] = 'jsonc',
['.justfile'] = 'just',
Kconfig = 'kconfig',
['Kconfig.debug'] = 'kconfig',
+ ['Config.in'] = 'kconfig',
['lftp.conf'] = 'lftp',
['.lftprc'] = 'lftp',
['/.libao'] = 'libao',
@@ -1393,6 +1398,7 @@ local filename = {
octaverc = 'octave',
['octave.conf'] = 'octave',
opam = 'opam',
+ ['pacman.log'] = 'pacmanlog',
['/etc/pam.conf'] = 'pamconf',
['pam_env.conf'] = 'pamenv',
['.pam_environment'] = 'pamenv',
@@ -1654,6 +1660,11 @@ local pattern = {
['.*/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,
@@ -1730,6 +1741,7 @@ local pattern = {
['[jt]sconfig.*%.json'] = 'jsonc',
['[jJ]ustfile'] = 'just',
['Kconfig%..*'] = starsetf('kconfig'),
+ ['Config%.in%..*'] = starsetf('kconfig'),
['.*%.[Ss][Uu][Bb]'] = 'krl',
['lilo%.conf.*'] = starsetf('lilo'),
['.*/etc/logcheck/.*%.d.*/.*'] = starsetf('logcheck'),
@@ -1903,7 +1915,7 @@ local pattern = {
['.*baseq[2-3]/.*%.cfg'] = 'quake',
['.*quake[1-3]/.*%.cfg'] = 'quake',
['.*id1/.*%.cfg'] = 'quake',
- ['.*/queries/.*%.scm'] = 'query', -- tree-sitter queries (Neovim only)
+ ['.*/queries/.*%.scm'] = 'query', -- treesitter queries (Neovim only)
['.*,v'] = 'rcs',
['%.reminders.*'] = starsetf('remind'),
['[rR]akefile.*'] = starsetf('ruby'),
@@ -2070,6 +2082,7 @@ local function normalize_path(path, as_pattern)
end
--- @class vim.filetype.add.filetypes
+--- @inlinedoc
--- @field pattern? vim.filetype.mapping
--- @field extension? vim.filetype.mapping
--- @field filename? vim.filetype.mapping
@@ -2260,16 +2273,31 @@ local function match_pattern(name, path, tail, pat)
end
--- @class vim.filetype.match.args
+--- @inlinedoc
+---
+--- Buffer number to use for matching. Mutually exclusive with {contents}
--- @field buf? integer
+---
+--- Filename to use for matching. When {buf} is given,
+--- defaults to the filename of the given buffer number. The
+--- file need not actually exist in the filesystem. When used
+--- without {buf} only the name of the file is used for
+--- filetype matching. This may result in failure to detect
+--- the filetype in cases where the filename alone is not
+--- enough to disambiguate the filetype.
--- @field filename? string
+---
+--- An array of lines representing file contents to use for
+--- matching. Can be used with {filename}. Mutually exclusive
+--- with {buf}.
--- @field contents? string[]
--- Perform filetype detection.
---
--- The filetype can be detected using one of three methods:
---- 1. Using an existing buffer
---- 2. Using only a file name
---- 3. Using only file contents
+--- 1. Using an existing buffer
+--- 2. Using only a file name
+--- 3. Using only file contents
---
--- Of these, option 1 provides the most accurate result as it uses both the buffer's filename and
--- (optionally) the buffer contents. Options 2 and 3 can be used without an existing buffer, but
@@ -2295,18 +2323,6 @@ end
---
---@param args vim.filetype.match.args Table specifying which matching strategy to use.
--- Accepted keys are:
---- * buf (number): Buffer number to use for matching. Mutually exclusive with
---- {contents}
---- * filename (string): Filename to use for matching. When {buf} is given,
---- defaults to the filename of the given buffer number. The
---- file need not actually exist in the filesystem. When used
---- without {buf} only the name of the file is used for
---- filetype matching. This may result in failure to detect
---- the filetype in cases where the filename alone is not
---- enough to disambiguate the filetype.
---- * contents (table): An array of lines representing file contents to use for
---- matching. Can be used with {filename}. Mutually exclusive
---- with {buf}.
---@return string|nil # If a match was found, the matched filetype.
---@return function|nil # A function that modifies buffer state when called (for example, to set some
--- filetype specific buffer variables). The function accepts a buffer number as