Wrong indentation when editing Yaml in Vim

前端 未结 7 1138
一整个雨季
一整个雨季 2021-01-30 03:50

Vim does not seem to correctly react at a dash symbol in YAML files therefore breaking the format.

For example I have a block which should look like this:



        
7条回答
  •  故里飘歌
    2021-01-30 04:16

    You can add a comment in your YAML to tell Vim special config for this file. For example:

    # vim: set shiftwidth=2 tabstop=2 softtabstop=-1 expandtab:
    foo:
      bar:
      - a
      - b
    

    Then everyone, who use this file with a default vim, can share the file creator's configuration. It works well especially when cooperating.

提交回复
热议问题