Any idea how I can auto indent (using cindent) from the command
line? I'm writing a shell script to indent all my source files.
This is the core of it:
for f in $@; do
vim -f $f +"set tw:80" +"set ts:4" +"set sw:4" \
+"set cindent" \ # ... now what?
+"wq"
done
Now I want to add the command for indenting. The problem is
that '=' won't work here (there's nothing like ':,%='). I can
specify a range, but what command to apply to the range?
One thing is this - ':,% !indent' - will indent a C file, but I
really need this for Java (and the vim built-in indent, the =
command, works perfectly for Java).
Any ideas? How do people auto indent their Java/Perl files
_from the command line_ (without manually doing gg=G in Vim for
each file)?
Manish