Either pass all C files to the Vim executable vim file1.c dir/file2.c
, or add them as arguments from inside Vim (see :help file-searching
):
:args **/*.c **/*.h
Then, you can mass-edit them via :argdo
. Vim has a built-in indenting mechanism, or it can use an external code formatter. Read up on the details at :help C-indenting
.
Once you've configured the indent settings ('cindent'
, 'cinoptions'
, etc.), you can apply all files via
:argdo execute 'normal! ggVG=' | update
(ggVG
selects the entire buffer in visual mode, =
then re-formats.)