Wrong indentation when editing Yaml in Vim

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

    You can disable reindent when you type : key:

    :set indentkeys-=<:>
    

    Please edit ~/.vimrc file, and add these lines:

    filetype plugin indent on
    autocmd FileType yaml setl indentkeys-=<:>
    

    Note: autocmd comes after filetype.


    You can trigger reindent by typing CTRL-F in INSERT mode, for example:

    hello: world
        foo: bar<C-F>
    
    0 讨论(0)
提交回复
热议问题