Is there a way to proofread indent in vim?

Asked 1 years ago, Updated 1 years ago, 79 views

Sometimes, if you write "while" or "if" incorrectly and erase it, It's annoying because I have to indent them one by one. There's an automatic indentation in the visual studio Isn't there a function like that in vim?

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

How do I write this code automatically?

c vim code-formatting

2022-09-21 14:37

1 Answers

gg=G Try it.

It means that you should proceed with the indentation of the file from beginning to end, and if you open each separately

gg starts from the top of the file = indent, G means to run to the end of the file.


2022-09-21 14:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.