Use vim.filetype.add over creating an autocmd
This commit is contained in:
@@ -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'
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user