Tips for editing YAML with Notepad++

A few things that helped make it easier for me to edit YAML with Notepad++:

  • Make N++ display whitespace - under View >> Show Symbol, turn on “Show White Space and TAB”

  • Make N++ use spaces instead of tabs - tabs are going to break YAML parsing. But you probably don’t want to turn off the tab character globally. N++ lets you make it so that when you hit TAB, it’ll insert the number of spaces you choose. Go to Settings >> Preferences and choose Tab Settings. Scroll down in the “Tab Settings” list to “yaml”. Uncheck the “use default value” and choose “replace by space”. When you open a YAML document, you may need to choose “YAML” under the “Language” menu to let it know that you’re editing a YAML doc.

  • Quickly Indenting/Outdenting - you can select a block of text in N++ and hit TAB to indent the entire block. Shift-TAB will outdent the block.

  • Commenting Code - You can use CTRL-K to comment a block of code (prepend with #) and Shift-CTRL-K to uncomment a block.

BRUH Automation has a good video showing you how to set up SAMBA file sharing so that it’s easy to edit your configuration.yaml remotely.


Thanks for writing that up!

yes - thanks indeed!

I do the same with gedit on Linux. Setting tabs to two spaces really cuts down on silly mistakes.

I’m using N++ 7.1, and for some reason when I untick “Use default value” for yaml specifically, it does not allow me to edit “replace by space” and number of spaces. It works for other languages, for example for Python I was able to adjust this.


Is there a way, to lock in yaml as the DEFAULT language, or maybe according to the file’s extention, (.yaml, .txt, etc.).???

Either way, if I open Notepad++, then select File/Open or if I right click the file, then select “open with Notepad++”. I always have goto “Language” in Notepad++, and select YAML.

go to settings>new files then choose yaml as language

Settings >> Style Configurator. Then choose “YAML”. It’ll already be set to expect “.yml” - add “.yaml”

(Looks like I can’t edit my original post - moderators: is that something that can be fixed?)

Making N++ use spaces instead of tabs
As of version 7.1 of Notepad++, the interface has changed a bit. To set N++ to use spaces instead of tabs, open Preferences and choose Language. On the right side of the screen, there’s options to adjust tabs. When you first open that setting, you’ll likely be editing the default tab settings. Scroll down that list and choose yaml and then you can check “Replace by space” and set “Tab size” to 2.


[quote=“ih8gates, post:1, topic:4295”]
Go to Settings >> Preferences and choose Tab Settings . Scroll down in the “Tab Settings” list to “yaml”.[/quote]

What ver of NPP++ are you using? I dont have YAML in the list to edit. YAMl shows up as a language but not in style configurator.

Great, now all i need to do is work the YAML highlighting so I can read my stuff… YAML doesn’t show up as a language option in the style configurator. I may have to reinstall , YAML is not included in bespin.xml in my version, so no extension based style reference.

1 Like

Definitely update the tab stop to be 2 spaces.
The Home Assistant yaml implementation seems to be broken; entering the alarm control panel with 2 spaces works, but fails when using 4 (Yaml specs say “The amount of indentation is a presentation detail and must not be used to convey content information.”)

    - platform: manual
        name: Security
        # Don't require a code to arm the security system
        code_arm_required: false
        disarm_after_trigger: true       # so it doesn't re-trigger
            arming_time: 0               # how long before alarm is armed
            delay_time: 0                # how long before the alarm is triggered
            trigger_time: 300            # stay triggered for 300 seconds
            # Ensure the alarm can never be triggered when disarmed
            trigger_time: 0
1 Like

reading specs and implementing these 100% accurate without making things even more restrictive but it was initally defined is something most software vendors fail, even the commercial ones.

The first mistake was done when defining yaml … this must have been dudes who disliked the one which invented the tab char … :slight_smile:#

And I do like the tab character since it eases things a lot.