Restructure syntax rules

This commit is contained in:
Ben Kreeger 2025-07-20 20:19:05 -05:00
parent ff05d0645b
commit 0fa09222e1
Signed by: kreeger
GPG Key ID: D5CF8683D4BE4B50
2 changed files with 20 additions and 14 deletions

4
nvim/ftplugin/html.lua Normal file
View File

@ -0,0 +1,4 @@
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.softtabstop = 0
vim.bo.expandtab = false

View File

@ -6,18 +6,20 @@ vim.api.nvim_create_autocmd("TextYankPost", {
end,
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
desc = "Enforce Terraform filetype",
pattern = { "*.tf" },
callback = function()
vim.opt.filetype = "terraform"
end,
})
-- Filetype detection
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
desc = "Enforce ProGuard filetype",
pattern = { "*.pro" },
callback = function()
vim.opt.filetype = "proguard"
end,
})
local filetype_maps = {
{ pattern = "*.tf", ft = "terraform" },
{ pattern = "*.pro", ft = "progruard" },
{ pattern = "*.mjml", ft = "html" },
}
for _, mapping in ipairs(filetype_maps) do
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
desc = string.format("Enforce filetype for %s", mapping["pattern"]),
pattern = { mapping["pattern"] },
callback = function()
vim.opt.filetype = mapping["ft"]
end,
})
end