nvim/filetype.lua

69 lines
2.0 KiB
Lua
Raw Permalink Normal View History

2023-10-27 19:00:00 +02:00
vim.filetype.add {
filename = {
2024-02-08 18:00:00 +01:00
vifmrc = 'vifm',
2023-10-27 19:00:00 +02:00
['.ansible-lint'] = 'yaml',
['.yamllint'] = 'yaml',
['ansible.cfg'] = 'ini',
['BUCK'] = 'bzl',
['flake.lock'] = 'json',
2024-01-05 18:00:00 +01:00
['MODULE.bazel.lock'] = 'json',
2023-10-27 19:00:00 +02:00
['go.mod'] = 'gomod',
['mopidy.conf'] = 'cfg',
['mpDris2.conf'] = 'cfg',
['mpd.conf'] = 'conf',
['terraform.tfstate'] = 'json',
},
extension = {
dj = 'djot',
gwl = 'wisp',
2023-10-27 19:00:00 +02:00
hurl = 'hurl',
j2 = 'jinja',
jinja = 'jinja',
jinja2 = 'jinja',
2023-10-27 19:00:00 +02:00
k = 'kcl',
kk = 'koka',
mdx = 'markdown.mdx',
2023-10-27 19:00:00 +02:00
mmd = 'mermaid',
ncl = 'nickel',
nu = 'nu',
purs = 'purescript',
rasi = 'rasi',
rasinc = 'rasi',
res = 'rescript',
resi = 'rescript',
2023-10-27 19:00:00 +02:00
river = 'hcl',
templ = 'templ',
tmpl = 'gotmpl',
2023-10-27 19:00:00 +02:00
typ = 'typst',
w = 'wisp',
wisp = 'wisp',
2023-10-27 19:00:00 +02:00
},
pattern = {
['${HOME}/.kube/config'] = 'yaml',
-- Ansible
['.*/roles/[^/]+/tasks/.+%.ya?ml'] = 'yaml.ansible',
['.*/roles/[^/]+/handlers/[^/]+%.ya?ml'] = 'yaml.ansible',
['.*/playbooks/[^/]+%.ya?ml'] = 'yaml.ansible',
-- Helm chart templates
['.*/templates/.+%.ya?ml'] = 'helm',
['.*/templates/.+%.tpl'] = 'helm',
2023-10-27 19:00:00 +02:00
-- Waybar config
['${XDG_CONFIG_HOME}/waybar/config'] = 'jsonc',
-- please.build
['%.?plzconfig'] = 'gitconfig',
['%.plzconfig_[%w_]+'] = 'gitconfig',
['%.plzconfig.[%w_%-]+'] = 'gitconfig',
-- Fallback logic
['.*'] = {
priority = -math.huge,
function(_, bufnr)
local first_line = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] or ''
---@diagnostic disable-next-line: param-type-mismatch
if first_line:find('^#!.*[%s/]nft %-f$') then
return 'nftables'
end
end,
},
2023-10-27 19:00:00 +02:00
},
}