[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Textmate like code block alignment (ruby-mode)

From: Marcelo de Moraes Serpa
Subject: Re: Textmate like code block alignment (ruby-mode)
Date: Tue, 6 Jul 2010 12:05:36 -0500

Hi Deniz,

Thanks for being so helpful ;)

Well, my config has snippets attached to TAB too, so if I hit TAB, it
will try to complete "end". I'm using a fork of emacs-starter-kit,
and, although I have modified it a lot already, I didn't have the time
to peek into it the way I wanted so as to understand how things are
wired up, I'll need to to that eventually.

Anyway, thanks for the suggestion. Using C-j already had this
behaviour built-in btw,


On Tue, Jul 6, 2010 at 12:01 PM, Deniz Dogan <address@hidden> wrote:
> 2010/7/6 Marcelo de Moraes Serpa <address@hidden>:
>> Hey list,
>> I have ruby-mode setup and it works pretty well. One thing though is
>> that it doesn't automatically align blocks, and I have to type C-a TAB
>> to make it align the end with a def for example:
>> def func <when I press ENTER here>
>>      |<the pointer goes here>
>> I'd like it to behave like Textmate, where when you press enter after
>> the beginning of a code block, it automatically aligns the end to like
>> so:
>> def func <when I press ENTER here>
>> |<the cursor goes here, where it should be>
>> It's really annoying having to align manually.
>> Any ideas?
>> Thanks in advance,
>> Marcelo.
> You could try binding RET to newline-and-indent (bound to C-j by default).
> Try something like this (untested):
> (add-hook 'ruby-mode-hook
>  (lambda ()
>    (define-key ruby-mode-map (kbd "RET") 'newline-and-indent)))
> By the way, you normally don't have to move the cursor anywhere to
> indent the current line. Just hit TAB with the cursor anywhere on the
> line you wish to indent "correctly" and it will work just as well.
> --
> Deniz Dogan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]