diff options
Diffstat (limited to 'ftdetect/polyglot.vim')
-rw-r--r-- | ftdetect/polyglot.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index fdb540e2..ee6cd63a 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1,3 +1,18 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1 + +function! DetectAnsible() + let filepath = expand("%:p") + let filename = expand("%:t") + if filepath =~ '\v/(tasks|roles)/.*\.ya?ml$' || filepath =~ '\v/(group|host)_vars/' || filename =~ '\v(playbook|site)\.ya?ml$' + set ft=ansible + endif + unlet filepath + unlet filename +endfunction +:au BufNewFile,BufRead *.yml,*yaml,*/{group,host}_vars/* call DetectAnsible() +:au BufNewFile,BufRead *.j2 set ft=ansible_template +:au BufNewFile,BufRead hosts set ft=ansible_hosts +endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'arduino') == -1 au BufRead,BufNewFile *.ino,*.pde set filetype=arduino |