Wrong indentation when editing Yaml in Vim

前端 未结 7 1101
一整个雨季
一整个雨季 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:23

    In order to get the nice 2-space YAML as the default when I hit carriage return after the colon, I added this to my .vimrc:

    autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
    

    This also plays nice with the dash for the OP's expected result.

提交回复
热议问题