Friday, July 30, 2010

Re: language-specific indenting?

On 30/07/10 03:55, Lev Lvovsky wrote:
> So an emacs-using co-worker was surprised when he found out that *I* didn't know how to do this (taking it to mean that vim didn't):
>
> If I'm given a perl script (I'm using this as an example since it's an especially tricky thing to parse from what I understand), and it's not at all indented, can perl automatically indent it for me? Ideally, this would include things like datastructures, but it seems in my attempts, that that's where parsing/indenting fails.
>
> I'm using the '=' command for indentation.
>
> Thank you!
> -lev
>

Well, if you're using = for indentation, then what about gg=G (gg:move
to line 1; ={motion}: indent whatever the cursor moves over; G:move to
last line)?

I don't use Perl, but I suppose that you have "filetype plugin indent
on" in your vimrc (or that it sources the vimrc_example.vim), and that
the Perl indent script sets the right options for = to work.


Best regards,
Tony.
--
A well adjusted person is one who makes the same mistake twice without
getting nervous.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: