4

I want to indent multiple files which are poorly indented and indent them properly as would vim do when I type gg=G. Is there someway to enter the = command or its alias in the command mode? i.e after a :? If that is possible I can use the bufdo command like in this question.

2 Answers 2

5

You can run any normal command with :normal, e.g. :normal =G.

If the files are C source code, it may be easier to use the external program indent.

1
  • 1
    I recomment astyle over indent. Jun 10, 2011 at 13:19
1

Not sure how to do it with vim, but should be possible.

You may also try the command "indent", it should do what you want, although not with the indentation you have configured in vim.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .