Forum: Ruby vim reindent/beautify tip

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A0c079a7c3c9b2cf0bffebd84dc578b0?d=identicon&s=25 unknown (Guest)
on 2006-05-14 14:57
(Received via mailing list)
Many of you might already know this but if not here's an interesting
tip I just discovered over on vim.org/tips.

Base assumption: you have installed the ruby-vim gem and the vim
files are in the correct places.

If you have old ruby files that have screwed up formatting, you can
beautify them (re-indent) using vim.

1. Open the file.
2. Hit control-g to discover how many lines are in the file.
3. While still in command-mode, type that number and then type
"==" (without the quotes). It will reindent everything.

cr
4dd517f4ae5f677691f747f91337df91?d=identicon&s=25 Henry T. So Jr. (Guest)
on 2006-05-14 15:16
(Received via mailing list)
On Sunday, 14 May 2006 at 09:56:27 pm +0900, cremes.devlist@mac.com
wrote:
> 2. Hit control-g to discover how many lines are in the file.
> 3. While still in command-mode, type that number and then type
> "==" (without the quotes). It will reindent everything.
>
> cr

A slightly easier way to do this is to type =G (capital G) when the
cursor is on the top line of the file.

Henry.
Ad4caa46eebe9347305177fc33468563?d=identicon&s=25 Mike Nelson (miken700)
on 2006-05-14 17:40
Henry T. So Jr. wrote:
> A slightly easier way to do this is to type =G (capital G) when the
> cursor is on the top line of the file.

or from anywhere,

gg=G

i think the gem name actually vim-ruby... or maybe not because, whenever
I do =G the indenting gets really messed up.
F3b7109c91841c7106784d229418f5dd?d=identicon&s=25 Justin Collins (justincollins)
on 2006-05-14 22:41
(Received via mailing list)
Mike Nelson wrote:
> i think the gem name actually vim-ruby... or maybe not because, whenever
> I do =G the indenting gets really messed up.
>
>
Or, use 'v' to enter visual mode, highlight the section you want to
re-indent, and press '='

A variety of options :)

-Justin
This topic is locked and can not be replied to.