summaryrefslogtreecommitdiffstats
path: root/ftdetect
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-12-17 10:48:07 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2015-12-17 10:49:17 +0100
commit7679a92627661ef2d6878079a5c53bf3669aabf7 (patch)
tree1c7d94fce4cf982d2bd57e31b886c6a112bb12c0 /ftdetect
parentad44c4f7a316e798a9354197b20a80eabf280f1a (diff)
downloadvim-polyglot-7679a92627661ef2d6878079a5c53bf3669aabf7.tar.gz
vim-polyglot-7679a92627661ef2d6878079a5c53bf3669aabf7.zip
Add ansible support, closes #96
Diffstat (limited to 'ftdetect')
-rw-r--r--ftdetect/polyglot.vim15
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