ruby - How can I add intelligent alignment of assignments and hashes to indent-region in emacs? -


When I have a code:

  a = 1 foo = 2   

And I want to show it like this:

  a = 1 foo = 2   

I-align-to-different Function defined here:

Selection and function of the area is underway. I can also change the function to work for hash by changing '=' in the function definition; = 'Gt;' And he has:

  bar = {: a => 1 ,: foo = & gt; 2}   

Change to:

  bar = {: a => 1 ,: foo = & gt; 2}   

I want this alignment to be done on all my codes when I select the entire buffer and start the indent area but I think it should be done wisely - Not every aligning '=' in the buffer is equal to 'fourth', instead it is doing the job for block and individual hash literals.

Edit: To clarify this last part, I have the following buffer:

  a = 1 foo = 2 some_other_code def Fn bar = {: A = & gt; 1 ,: foo = & gt; 2} end   

I want to 'cx' (select the entire buffer), 'mc-' (indent-field) and it looks like this: a = 1 foo = 2 some_other_code def fn bar = {: a => 1 ,: foo = & gt; 2} end

Try Mx align-regexp < Code> = . And this is also for others.

Comments