Update search and helm filetype config
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user