sponsor Vim development Vim logo Vim Book Ad

ansible-vim : Syntax highlighting Ansible's common filetypes

 script karma  Rating 74/33, Downloaded by 4537  Comments, bugs, improvements  Vim wiki

created by
Dave Honneffer
script type
Official repo here: https://github.com/pearofducks/ansible-vim

This is a vim syntax plugin for Ansible 2.0, it supports YAML playbooks, Jinja2 templates, and dotini-based 'hosts' files.

YAML playbooks are detected if:
- they are in the group_vars or host_vars folder
- they are in the tasks or roles folder and have either a .yml or .yaml suffix
- they are named playbook.y(a)ml or site.y(a)ml
Jinja2 templates are detected if they have a .j2 suffix
Files named hosts will be treated as Ansible hosts files

This plugin should be quite reliable, as it sources the original formats and simply modifies the highlights as appropriate. This also enables a focus on simplicity and configurability instead of patching bad syntax detection.
install details
Expand the archive then:

cp -r ftdetect ftplugin syntax  ~/.vim/

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ansible-vim-1.0.zip 1.0 2015-11-08 7.0 Dave Honneffer - "hosts" files are now highlighted with our own rules, rather than use dosini rules. This allows for much better treatment of variables and Ansible's special categories (e.g. [foo:vars])
ansible-vim-0.9.zip 0.9 2015-09-18 7.0 Dave Honneffer Significantly improved indentation from 0.8
ansible-vim-0.8.zip 0.8 2015-09-13 7.0 Dave Honneffer Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github