Restructure syntax rules
This commit is contained in:
parent
ff05d0645b
commit
0fa09222e1
4
nvim/ftplugin/html.lua
Normal file
4
nvim/ftplugin/html.lua
Normal file
@ -0,0 +1,4 @@
|
||||
vim.bo.tabstop = 2
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.softtabstop = 0
|
||||
vim.bo.expandtab = false
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user