YAML has a syntax that makes it incompatible with indentation that is not 2 spaces. With 4 spaces, you have:

droggel:
    jug:
        - sequence item: with indentation
          this line: isn't aligned to four spaces
          nor are further indented lines:
               if you indent relative four spaces
    spam:
    - same: problem
      without: indenting the sequence item

This makes it hard for code formatters to get it right. Proper alignment would mean:

droggel:
    jug:
        -   three spaces after the sequence item indicator.
            that's horrible, nobody does that.
    spam:
      - alternatively this.
        nobody does this either and it breaks
      - - with nested sequences

I assume some bug in IntelliJ causes the formatter to be confused because of this. Generally it would be better to just use 2 space indentation which seems far more natural due to the problems described above. That should avoid confusing the formatter.

Answer from flyx on Stack Overflow
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360000037890-YAML-formatting
YAML formatting – IDEs Support (IntelliJ Platform) | JetBrains
OK, so it is for RUBY but I suspect if you have YAML formatting for one thing, you would re-use it everywhere. However there is a large chance I am suffering from temporary cerebral aphasia (non-heriditary stupidity) - because I do this and get zero results: ... It's still work in progress. ... Yes, unless the plug-in implements its own formatting.
🌐
JetBrains
jetbrains.com › help › idea › code-style-yaml.html
Code Style. YAML | IntelliJ IDEA Documentation
April 21, 2026 - Use this page to configure formatting options for YAML files. When you change these settings, the Preview pane shows how this will affect your code. In this tab, customize the exceptions, brace placement and alignment options that IntelliJ IDEA will apply to various code constructs on reformatting ...
🌐
JetBrains
jetbrains.com › help › idea › yaml.html
YAML | IntelliJ IDEA Documentation
August 4, 2026 - Use the Structure tool window (Alt+7) to quickly navigate through YAML files. To show or hide elements of reused anchors in the Structure tool window, click use Aliased sub-trees.
🌐
JetBrains
youtrack.jetbrains.com › issue › IDEA-212976 › Formatter-for-YAML
Formatter for YAML : IDEA-212976 - YouTrack
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions.
🌐
JetBrains
plugins.jetbrains.com › plugin › 10081-jetbrains-academy › docs › meet-yaml-format.html
Introducing YAML format - JetBrains Academy | JetBrains Marketplace
May 28, 2026 - Compatible with IntelliJ IDEA, Android Studio and 7 more · Overview · Versions · Reviews · What's New · Documentation · JetBrains Academy 2.7 provides a completely reworked solution for storing course configuration files. Previously, all course metadata was stored in XML format. Now you can see all the information about your course conveniently stored in YAML format.
Rating: 4.2 ​ - ​ 74 votes
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 7683389771794-Adding-simple-features-to-yaml-ctrl-click-references-best-method
Adding simple features to yaml (ctrl-click references) - best method? – IDEs Support (IntelliJ Platform) | JetBrains
I would just add that you should provide references for YAML string literals, with the text range covering the reference parts. These references should resolve to the YAML keys you should find in your definition files. ... https://plugins.jetbrains.com/docs/intellij/references-and-resolve.html - general references topic description
Find elsewhere
🌐
JetBrains
plugins.jetbrains.com › plugin › 11069-yaml-file-generator
YAML File Generator Plugin for IntelliJ IDEA & MPS | JetBrains Marketplace
January 10, 2020 - This plugin is used to generate Yaml file from a Properties file. Usage: After installing the plugin: Open the properties file. Right click on editor region. Select 'Generate Yaml File' option. A new Yaml file (with same name as properties file) will be generated in same directory as the selected ...
🌐
YouTube
youtube.com › watch
Day #4 A YAML Viewer for IntelliJ IDEA - YouTube
I created a new free YAML Viewer for IntelliJ IDEA (and other JetBrains IDE like Android Studio) with an application named Tree Data ExplorerJetBrains Market...
Published: April 14, 2023
🌐
Controlyourmindset
controlyourmindset.com › posts › f291cf68a41fa0db54680a4ccb090c5e
How do I open a YAML file in IntelliJ? – Control Your Mindset
Search for the plugin google-java-format by Google. Install it. Restart IntelliJ IDEA. ... Install the Checkstyle-IDEA plugin by going to File > Settings (Windows/Linux), or IntelliJ IDEA > Preferences… … · Click File > Settings…​ > Other Settings > Checkstyle. Set Scan Scope to Only Java sources (including tests) , so that the plugin will run checkstyle for our test source codes as well. You can open a YAML ...
🌐
JetBrains
jetbrains.com › help › ruby › yaml.html
YAML | RubyMine Documentation
RubyMine supports working with ... in the YAML file, the editor will show a warning that this anchor is not used by any node. The editor enables you now to complete aliases for this anchor. You can navigate from aliases to the anchor using the Ctrl+B shortcut....
🌐
Medium
medium.com › @alexmolev › boost-your-yaml-with-autocompletion-and-validation-b74735268ad7
Boost your YAML with autocompletion and validation | by Alex Molev | Medium
September 1, 2020 - First thing first you need to download YAML Language plugin. Open Extensions by going to Code->Preferences->Extensions or use keyboard shortcut SHIFT+CMD+X
🌐
GitHub
github.com › aesy › yamllint-intellij
GitHub - aesy/yamllint-intellij: Yamllint integration for IntelliJ-based IDEs · GitHub
Yamllint integration for IntelliJ-based IDEs. Contribute to aesy/yamllint-intellij development by creating an account on GitHub.
Author: aesy
🌐
JetBrains
youtrack.jetbrains.com › issue › IJPL-64442 › Re-format-of-yaml-while-pasting-the-yaml-code
Re-format of yaml while pasting the yaml code : IJPL-64442
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions.
🌐
Magnolia
magnolia-cms.com › home › magnolia dxp marketplace › yaml assistant for intellij
YAML Assistant for IntelliJ | Magnolia DXP
The YAML Assistant for IntelliJ accelerates Magnolia Light Development by making it even easier for developers to edit Magnolia configuration files in IntelliJ.
🌐
JetBrains
youtrack.jetbrains.com › issue › IDEA-169320
"Auto-Indent Lines" action not available for YAML files
March 31, 2023 - Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 4664945389202-YAML-tab-size-forced-at-4-spaces
YAML tab size forced at 4 spaces? – IDEs Support (IntelliJ Platform) | JetBrains
March 15, 2022 - When I hit tab inside a .yaml file - it is indented with 2 spaces here, not 4. Are you on 2021.3.2? Is it a pure .yaml file? Do you have an .editorconfig file in the project that could possibly interfere with IDE settings? ... I get inconsistent auto-indent behavior in .yml files depending on whether I paste or hit Tab or use keyboard shortcut auto-formatting (selected or unselected text), or from which context it's coming from (like from a previous line after hitting Enter/Return).