Detect Helm files with filetype.lua

Hey folks. With the new availability of filetype.lua, I was curious if anyone had ideas on how to differentiate Helm templates from regular YAML files? Perhaps adding a function to the yaml extension and introspecting? Maybe looking for the mustache double braces {{ ?

I got this problem too. Did you solve it @mnarrell ?

I ended up just going with GitHub - towolf/vim-helm: vim syntax for helm templates (yaml + gotmpl + sprig + custom) but you could harvest the filetype detection patterns and add them:

vim.filetype.add({
  pattern = {
    [".*/templates/.*%.yaml"] = "helm",
  },
})