Geo
Geo

Reputation: 96797

How can I custom indent a file with vim?

I recently read this article related to indenting source files in Vim . However , I would like to be able to custom indent some of them . Is there a way to specify which binary runs when I press = ?

Upvotes: 5

Views: 1048

Answers (2)

WMR
WMR

Reputation: 12971

You can set the equalprg-option. (see :he = for more).

Upvotes: 3

Greg Hewgill
Greg Hewgill

Reputation: 993015

From the help:

={motion}       Filter {motion} lines through the external program
                given with the 'equalprg' option.  When the 'equalprg'
                option is empty (this is the default), use the
                internal formatting function |C-indenting|.  But when
                'indentexpr' is not empty, it will be used instead
                |indent-expression|.

It looks like setting the equalprg option is what you want.

Upvotes: 7

Related Questions