How can I autoformat/indent C code in vim?

后端 未结 9 2449
青春惊慌失措
青春惊慌失措 2020-11-29 14:20

When I copy code from another file, the formatting is messed up, like this:

fun()
{
for(...)
{
for(...)
{
if(...)
{
}
}
}
}

How can I autof

9条回答
  •  遥遥无期
    2020-11-29 14:52

    I wanted to add, that in order to prevent it from being messed up in the first place you can type :set paste before pasting. After pasting, you can type :set nopaste for things like js-beautify and indenting to work again.

提交回复
热议问题