1

For instance, let's say I have the following block of code in a buffer:

pattern TTF_STYLE_NORMAL = #{const TTF_STYLE_NORMAL}
pattern TTF_STYLE_BOLD = #{const TTF_STYLE_BOLD}
pattern TTF_STYLE_ITALIC = #{const TTF_STYLE_ITALIC}
pattern TTF_STYLE_STRIKETHROUGH = #{const TTF_STYLE_STRIKETHROUGH}

I want to convert it into:

pattern TTF_STYLE_NORMAL        = #{const TTF_STYLE_NORMAL}
pattern TTF_STYLE_BOLD          = #{const TTF_STYLE_BOLD}
pattern TTF_STYLE_ITALIC        = #{const TTF_STYLE_ITALIC}
pattern TTF_STYLE_STRIKETHROUGH = #{const TTF_STYLE_STRIKETHROUGH}

I need some way of saying align this block into columns divided by the = character. Ideally, I'd like to be able to do the same thing with multiple delimiter characters, like splitting on a ->.

How could I accomplish this?

If there's a minor mode for it - great! Code samples welcome also.

Thanks!

liszt
  • 735
  • 1
  • 5
  • 11

1 Answers1

3

I should have googled a bit more before asking.

I can align the code by selecting it and applying align-regexp with an argument of =.

Feel free to give a potentially better and/or more detailed answer, I'll accept it.

liszt
  • 735
  • 1
  • 5
  • 11