Merge pull request #22 from luisdavim/patch-1

fix: improve file detection
This commit is contained in:
Tobias Wolf
2024-05-21 10:22:30 +02:00
committed by GitHub
+10 -1
View File
@@ -1,4 +1,13 @@
autocmd BufRead,BufNewFile */templates/*.{yaml,yml},*/templates/*.tpl,*.gotmpl,helmfile*.{yaml,yml} set ft=helm
function! s:isHelm()
let filepath = expand("%:p")
let filename = expand("%:t")
if filepath =~ '\v/(templates|charts)/.*\.(ya?ml|gotmpl|tpl|txt)$' | return 1 | en
if filename =~ '\v(helmfile).ya?ml' | return 1 | en
if !empty(findfile("Chart.yaml", expand('%:p:h').';')) | return 1 | en
return 0
endfunction
autocmd BufRead,BufNewFile * if s:isHelm() | set ft=helm | en
" Use {{/* */}} as comments
autocmd FileType helm setlocal commentstring={{/*\ %s\ */}}