mirror of
https://github.com/zoriya/vim-helm.git
synced 2026-06-09 21:09:09 +00:00
Merge pull request #22 from luisdavim/patch-1
fix: improve file detection
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
|
" Use {{/* */}} as comments
|
||||||
autocmd FileType helm setlocal commentstring={{/*\ %s\ */}}
|
autocmd FileType helm setlocal commentstring={{/*\ %s\ */}}
|
||||||
|
|||||||
Reference in New Issue
Block a user