From 8e49ce6d6bd7976ed4c6bb732ecbd0d3a715e521 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Fri, 6 Sep 2024 17:56:05 +0200 Subject: [PATCH 1/2] feat: add custom filetypes --- ftdetect/filetype.lua | 11 +++++++++++ ftplugin/helm.lua | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 ftdetect/filetype.lua create mode 100644 ftplugin/helm.lua diff --git a/ftdetect/filetype.lua b/ftdetect/filetype.lua new file mode 100644 index 0000000..e02f1c6 --- /dev/null +++ b/ftdetect/filetype.lua @@ -0,0 +1,11 @@ +vim.filetype.add({ + pattern = { + [".*/templates/.*%.tpl"] = "helm", + [".*/templates/.*%.yaml"] = "helm", + ["helmfile.*%.yaml"] = "helm", + ["values.*%.yaml"] = "yaml.helm-values", + }, + filename = { + ["Chart.yaml"] = "yaml.helm-chartfile", + }, +}) diff --git a/ftplugin/helm.lua b/ftplugin/helm.lua new file mode 100644 index 0000000..47025ca --- /dev/null +++ b/ftplugin/helm.lua @@ -0,0 +1,2 @@ +-- set up the gotmpl commentstring +vim.opt_local.commentstring = "{{/* %s */}}" From 8dd01a3b451c8536d9704bb79ff76a31abbf525d Mon Sep 17 00:00:00 2001 From: qvalentin Date: Sat, 7 Sep 2024 17:09:01 +0200 Subject: [PATCH 2/2] fix: adjust filetype matchers --- ftdetect/filetype.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ftdetect/filetype.lua b/ftdetect/filetype.lua index e02f1c6..4175bab 100644 --- a/ftdetect/filetype.lua +++ b/ftdetect/filetype.lua @@ -1,8 +1,10 @@ vim.filetype.add({ pattern = { [".*/templates/.*%.tpl"] = "helm", - [".*/templates/.*%.yaml"] = "helm", - ["helmfile.*%.yaml"] = "helm", + [".*/templates/.*%.ya?ml"] = "helm", + [".*/templates/.*%.txt"] = "helm", + ["helmfile.*%.ya?ml"] = "helm", + ["helmfile.*%.ya?ml.gotmpl"] = "helm", ["values.*%.yaml"] = "yaml.helm-values", }, filename = {