Got cfn working nicely

This commit is contained in:
tedmoyses 2023-07-21 13:50:53 +01:00
parent bbc67edf62
commit 6cbbc7bce7
2 changed files with 102 additions and 1 deletions

18
filetype.lua Normal file
View file

@ -0,0 +1,18 @@
vim.filetype.add {
pattern = {
['.*'] = {
priority = math.huge,
function(path, bufnr)
local line1 = vim.filetype.getlines(bufnr, 1)
local line2 = vim.filetype.getlines(bufnr, 2)
if vim.filetype.matchregex(line1, [[^AWSTemplateFormatVersion]] ) or
vim.filetype.matchregex(line2, [[^AWSTemplateFormatVersion]] ) then
return 'yaml.cloudformation'
elseif vim.filetype.matchregex(line1, [[["']AWSTemplateFormatVersion]] ) or
vim.filetype.matchregex(line2, [[["']AWSTemplateFormatVersion]] ) then
return 'json.cloudformation'
end
end,
},
},
}