Vim does not seem to correctly react at a dash symbol in YAML files therefore breaking the format.
For example I have a block which should look like this:
I've found https://github.com/stephpy/vim-yaml to work great. It's a vim plugin that does indentation (and syntax highlighting) of yaml files. Installing it solves the specific problem that you've asked about too.
You need to install the plugin (see the doco in the GitHub repo) and as long as your filetype=yaml
it'll correct your indenting. It'll help you both
V
for line-wise selection then use j
or k
to select more lines) then trigger the vim formatting with =