Gundala Viswanath wrote:
Thanks Yakov,

gg=G

:help =

But it seems to me that works on Global basis strictly.
How can we localize the cleanup within a visual block?

Moreoever how can we customize the indentation, bracing, etc?
Since with Perl this customization is captured within .perltidyrc.



perltidy is an external program. Find an appropriate one for C ("indent" maybe) or for whatever language you're using, and you can use = or !filter in Visual mode; or leave 'equalprg' empty and you can use = with internal-to-Vim formatting functions as defined (for c) by 'cindent' 'cinkeys' 'cinwords' and 'cinoptions' or (in general) by ":filetype indent on", $VIMRUNTIME/indent/<fileype>.vim and whatever the latter sets, such as (for instance) 'indentexpr'.

See
        :help v_=
        :help =
        :help v_!
        :help filter
        :help v_gq
        :help gq
        :help 'equalprg'
        :help :filetype
        :help 'cindent'
        :help 'cinkeys'
        :help 'cinoptions'
        :help 'cinwords'
        :help 'indentexpr'
        :help 'formatoptions'
        :help fo-table
        :e $VIMRUNTIME/indent/
                " then hit <Enter> or o on any interesting script
        info indent
etc.


Best regards,
Tony.

Reply via email to