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:
You can use this autocommand to make Vim properly indent YAML files (put it to your .vimrc
):
" Fix auto-indentation for YAML files
augroup yaml_fix
autocmd!
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:>
augroup END
Basically, for YAML file it instructs Vim to:
#
) at the beginning of a line, or a colon.