How can I autoformat/indent C code in vim?

后端 未结 9 2446
青春惊慌失措
青春惊慌失措 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 15:12

    Their is a tool called indent. You can download it with apt-get install indent, then run indent my_program.c.

提交回复
热议问题