You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The filetype for playbooks is now set to `yaml.ansible`.
- Using a compound filetype here improves compatibility with some other plugins, and is a bit more honest about the filetypes being used. We _could_ set it to `yaml.jinja2.ansible`, if there are strong opinions on this please open an issue.
- This _only_ breaks setups using vim plugin on-demand loading features — e.g. `{ 'for': 'ansible' }` in vim-plug. Otherwise this change should not break anything.
- `g:ansible_extra_syntaxes` is now deprecated in favor of `g:ansible_template_syntaxes` — which will use conditional compound filetypes, instead of sourcing all filetypes listed and hiding them under `ansible_template`.
- While this is a complete deprecation of one setting, the new functionality is significantly better all around and should support the same use-cases.
- Example: a ruby+ansible-template will have a filetype of `ruby.jinja2` instead of `ansible_template`
One non-breaking change is also added, this plugin gains additional compatibility with _stephpy/vim-yaml_ — syntax highlights will be improved when using this plugin.
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,10 @@ This is a vim syntax plugin for Ansible 2.0, it supports YAML playbooks, Jinja2
22
22
- Jinja2 templates are detected if they have a *.j2* suffix
23
23
- Files named `hosts` will be treated as Ansible hosts files
24
24
25
-
You can also set the filetype to `ansible`, `ansible_template`, or `ansible_hosts` if auto-detection does not work (e.g. `:set ft=ansible`). **Note**: If you want to detect a custom pattern of your own, you can easily add this in your `.vimrc` using something like this:
25
+
You can also set the filetype to `yaml.ansible`, `*.jinja2`, or `ansible_hosts` if auto-detection does not work (e.g. `:set ft=yaml.ansible` or `:set ft=ruby.jinja2`). **Note**: If you want to detect a custom pattern of your own, you can easily add this in your `.vimrc` using something like this:
26
26
27
27
```vim
28
-
au BufRead,BufNewFile */playbooks/*.yml set filetype=ansible
28
+
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
29
29
```
30
30
31
31
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.
@@ -61,14 +61,11 @@ Use your favorite plugin manager, or try [vim-plug](https://github.com/junegunn/
61
61
62
62
When this variable is set, indentation will completely reset (unindent to column 0) after two newlines in insert-mode. The normal behavior of YAML is to always keep the previous indentation, even across multiple newlines with no content.
The space-separated options specified must be the actual syntax files, not the filetype - typically these are in something like `/usr/share/vim/syntax`. For example Bash is not `bash.vim` but seems to live in `sh.vim`.
66
+
`let g:ansible_yamlKeyName = 'yamlKey'`
68
67
69
-
This flag enables extra syntaxes to be loaded for Jinja2 templates. If you frequently work with specific filetypes in Ansible, this can help get highlighting in those files.
70
-
71
-
This will *always* load these syntaxes for *all* .j2 files, and should be considered a bit of a (temporary?) hack/workaround.
68
+
This option exists to provide additional compatibility with [stephpy/vim-yaml](https://github.com/stephpy/vim-yaml).
72
69
73
70
##### g:ansible_attribute_highlight
74
71
`let g:ansible_attribute_highlight = "ob"`
@@ -105,20 +102,29 @@ By default we only highlight: `include until retries delay when only_if become b
This option accepts the first line of each option in `:help E669` - thus the first 3 options are_Comment_, _Constant_, and _Identifier_
105
+
Accepts any syntax group name from `:help E669` - e.g._Comment_, _Constant_, and _Identifier_
109
106
110
107
*Note:* Defaults to 'Statement' when not set.
111
108
112
-
This controls the highlight of the following common keywords in playbooks: `include until retries delay when only_if become become_user block rescue always notify`
109
+
This option change the highlight of the following common keywords in playbooks: `include until retries delay when only_if become become_user block rescue always notify`
synkeywordansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin=yamlBlockMappingKeycontained
90
+
execute'syn keyword ansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin='.s:yamlKey.' contained'
0 commit comments