Tuesday, 18 October 2016

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go:Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

To automatically insert two spaces when you use the TAB key:
  1. In the 'Tab Settings' list, scroll down to 'yaml' and click on it.
  2. Make sure 'Use default value' is unchecked. Set 'Tab size' to 2 and check 'Replace by space'
  3. Then click close and Notepad++ will use spaces instead of tab.
To fix trailing and leading spaces causing YAML errors:
The most common problems with config files is spaces or tabs where they do not belong, here are 2 ways to fix this.
  1. Open the file in Notepad++ then select Edit > Blank Operations > TAB to space,
  2. Then select Edit > Blank Operations > Trim Trailing Space
Online YAML Testers:
  1. http://codebeautify.org/yaml-validator
  2. http://www.yamllint.com/
  3. http://yaml-online-parser.appspot.com/

No comments:

Post a Comment