Use vim.filetype.add over creating an autocmd

This commit is contained in:
2026-01-26 18:58:33 +01:00
parent 788f5a7ee1
commit 177b4f26ad

View File

@@ -57,17 +57,11 @@ Autocmd('BufEnter', {
end,
})
---@type table<string, string>
local filemap = {
['*.h'] = 'c',
['*/i3/**.conf'] = 'i3config'
}
for pat, file in pairs(filemap) do
Autocmd('BufRead', {
pattern = pat,
callback = function()
vim.bo.filetype = file
end
})
end
vim.filetype.add({
extension = {
h = 'c',
},
pattern = {
['${XDG_CONFIG_HOME}/i3/.*%.conf'] = 'i3config'
}
})