Editing YAML with VI

Put the following in your .vimrc file and you are set:

au BufNewFile,BufRead *.yaml,*.yml set et ts=2 sw=2

When you will be editing YAML files, you’ll automatically have the following behaviour:

  • et - expand tabs - puts spaces whenever you use tabs
  • ts=2 - tab stop - 2 spaces per tab
  • sw=2 - shift width - 2 spaces to move with < and > commands

YAML in VI

Leave a Reply