You could use wbond's Sublime Alignment
It may require you to add this to your settings file (Preferences>Package Settings>Alignment>Settings-User:
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": ["=", "|"],
// If the following character is matched for alignment, insert a space
// before it in the final alignment
"alignment_space_chars": ["=", "|"]
Replace "|" with whatever character you want to align.
Edit:
As mtoast has found out, adding "\n"
to "alignment_chars" gives the desired effect. Adding the new line character to "alignment_space_chars" is probably not needed and may delete the text. However, with my limited tests I did not see a difference.
Hold control and click at the end of each line. Then press the alignment hotkeys (For linux the default is ctrl + alt + a). You will find that the cursors are lined up with the furthest cursor position.
Edit2: Adding newline to "alignment_space_chars"
will delete text if you highlight a block of text and Sublime Alignment can't find something else to align on the line (like a equal sign).
Also, if Sublime Alignment can't find something else to align, adding newline to "alignment_chars"
will pad the end of lines with spaces (or tabs depending on your settings) to match longest line highlighted.
Tab
at the end of each line indents the ragged multi-cursor insert out to a straight column, but it's not possible to achieve the same effect using regex. I searched for trailing spaces:\s*$
and replaced them with the tab character:\t
- but\t
does not achieve the same effect as pressingTab
manually.