vim settings for YAML files
For editing YAML, be it for OpenShift / Kubernetes or Ansible, having your editor set up right can help to avoid common mistakes. So here is the minimalistic config in my ~/.vimrc
to make working with YAML files easier. I am sure there are even more plugins or settings available, but this minimal set of commands works fine for me:
set ts=2
set sts=2
set sw=2
set expandtab
syntax on
filetype indent plugin on
set ruler
Here is a quick explanation of what the settings above actually do:
set ts=2 | Sets tabstop to 2 for working with YAML |
set sts=2 | “softtabstop” makes spaces feel like tabs |
set sw=2 | Sets the shift width to 2, making shift operations (<< or >> ) |
set expandtab | Expands tabs to spaces |
syntax on | Enable syntax highlighting |
filetype indent plugin on | For certain filetypes, enable automatic indenting |
set ruler | Show column and line number |