Skip to content

Commit 69a5117

Browse files
committed
fix: improve file detection
This should fix #7 and #21 Signed-off-by: Luis Davim <luis.davim@gmail.com>
1 parent 86cc676 commit 69a5117

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ftdetect/helm.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
autocmd BufRead,BufNewFile */templates/*.{yaml,yml},*/templates/*.tpl,*.gotmpl,helmfile*.{yaml,yml} set ft=helm
1+
function! s:isHelm()
2+
let filepath = expand("%:p")
3+
let filename = expand("%:t")
4+
if filepath =~ '\v/(templates|charts)/.*\.(ya?ml|gotmpl|tpl|txt)$' | return 1 | en
5+
if filename =~ '\v(helmfile).ya?ml' | return 1 | en
6+
if !empty(findfile("Chart.yaml", expand('%:p:h').';')) | return 1 | en
7+
return 0
8+
endfunction
9+
10+
autocmd BufRead,BufNewFile * if s:isHelm() | set ft=helm | en
211

312
" Use {{/* */}} as comments
413
autocmd FileType helm setlocal commentstring={{/*\ %s\ */}}

0 commit comments

Comments
 (0)