Textmate: format ruby code

Hello,

I'm a newbie. New to textmate. New to ruby. I've looked at the ruby
bundles which come with textmate and to my dismay there is not a "make
my
ugly looking ruby code all nicely formatted and indented so its pretty"
bundle.

Jokes aside, how do I go about automatically indenting/formatting ruby
code in textmate?

Thanks in advance, Michelle

···

--
Posted via http://www.ruby-forum.com/.

Text -> Indent Selection

Make sure your file is in ruby mode.

class X
def x
42
end
end

becomes:

class X
  def x
    42
  end
end

···

On Aug 4, 2011, at 22:01 , Michelle Pace wrote:

Hello,

I'm a newbie. New to textmate. New to ruby. I've looked at the ruby
bundles which come with textmate and to my dismay there is not a "make
my
ugly looking ruby code all nicely formatted and indented so its pretty"
bundle.

Thanks Ryan and Josh. I've just found another really helpful keystroke -
the escape button for auto completion.

For any other newbies, from the textmate manual:

"TextMate has a simple yet effective completion function on ⎋ (escape).
It will complete the current word based on matches in the current
document. If there are multiple matches, you can cycle through these by
pressing ⎋ continuously. It is also possible to cycle backwards using
⇧⎋.

The matches are sorted by distance from the caret, meaning candidates
which are closer to the caret will be suggested before candidates
farther away."

···

--
Posted via http://www.ruby-forum.com/.

Hello,

···

On 5 Αυγ 2011, at 8:01 π.μ., Michelle Pace wrote:

Hello,

I'm a newbie. New to textmate. New to ruby. I've looked at the ruby
bundles which come with textmate and to my dismay there is not a "make
my
ugly looking ruby code all nicely formatted and indented so its pretty"
bundle.

Jokes aside, how do I go about automatically indenting/formatting ruby
code in textmate?

Thanks in advance, Michelle

--
Posted via http://www.ruby-forum.com/\.

If your file end's up in .rb or use the shebang 1st line you're all set with textmate.

What Iike about textmate though is the cmd+r behavior that executes the script as an IDE even if you have to add data (via gets etc.).

Regards

--
Panagiotis Atmatzidis

personal: atma@convalesco.org
lists: ml@convalesco.org
blog: http://www.convalesco.org

The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."

Also note that you need the document to be highlighted when you do this.

···

On Fri, Aug 5, 2011 at 3:04 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Aug 4, 2011, at 22:01 , Michelle Pace wrote:

> Hello,
>
> I'm a newbie. New to textmate. New to ruby. I've looked at the ruby
> bundles which come with textmate and to my dismay there is not a "make
> my
> ugly looking ruby code all nicely formatted and indented so its pretty"
> bundle.

Text -> Indent Selection

Make sure your file is in ruby mode.

class X
def x
42
end
end

becomes:

class X
def x
   42
end
end