Search code examples
emacsalignmentindentationprettify

aligning or prettifying code in emacs


I remember this was possible in emacs, but don't know how. If I have something like:

'abc' => 1,  
'abcabc' =>2,  
'abcabcabc' => 3,  

How can I align the keys, arrows and values to something like this?

'abc'       => 1,  
'abcabc'    => 2,  
'abcabcabc' => 3,  

Cheers


Solution

    • Select the region.

    • Type M-x align-regexp RET

    • Type = and hit enter.