Update search and helm filetype config

This commit is contained in:
2026-05-30 05:40:43 +03:00
parent 8d44bcc8c5
commit 2e44eeb06b
2 changed files with 132 additions and 60 deletions

View File

@@ -1,11 +1,26 @@
local function has_ancestor_file(path, filename)
local dir = vim.fs.dirname(path)
while dir and dir ~= '' do
if vim.uv.fs_stat(vim.fs.joinpath(dir, filename)) then
return true
end
local parent = vim.fs.dirname(dir)
if not parent or parent == dir then
return false
end
dir = parent
end
return false
end
vim.filetype.add({
pattern = {
['.*/templates/.*%.ya?ml'] = 'helm',
['.*/manifests/.*%.ya?ml'] = 'helm',
['.*/crds/.*%.ya?ml'] = 'helm',
['.*/kubernetes/.*%.ya?ml'] = 'helm',
['.*/k8s/.*%.ya?ml'] = 'helm',
['.*/charts/.*%.ya?ml'] = 'helm',
['.*/templates/.*%.ya?ml'] = function(path)
if has_ancestor_file(path, 'Chart.yaml') then
return 'helm'
end
end,
},
extension = {
gotmpl = 'helm',