Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 = ?

like image 911
Geo Avatar asked Feb 16 '09 22:02

Geo


2 Answers

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.

like image 187
Greg Hewgill Avatar answered Oct 16 '22 21:10

Greg Hewgill


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

like image 33
WMR Avatar answered Oct 16 '22 20:10

WMR