mirror of
https://github.com/zoriya/vim-helm.git
synced 2026-05-24 23:45:00 +00:00
fix: improve file detection
This should fix #7 and #21 Signed-off-by: Luis Davim <luis.davim@gmail.com>
This commit is contained in:
+10
-1
@@ -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\ */}}
|
||||
|
||||
Reference in New Issue
Block a user