Textmate add multiline text at end of line
- by Yuval
In Textmate, I am able to add text to several lines at once by clicking and holding the Option key and dragging with the mouse. say I have the following lines:
foo 1:
foo 2:
foo 3:
I can easily click and hold option and then drag down with the lines to select the text at the end of each line, and then type "bar" once and it will be added to all lines, as such:
foo 1: bar
foo 2: bar
foo 3: bar
Fantastic.
The problem I run into, is when my lines aren't the same length, as such
foo 19:
foo 37842342346:
foo 503:
Now if I want to add text to the end of each line, I have to either do it manually, or choose enough space so that the longest line is not overwritten, as such:
foo 19: bar
foo 37842342346: bar
foo 503: bar
This results in a lot of unwanted whitespace in lines that don't need it.
Granted, I could easily run a regular expression search to replace all multiple occurrences of a space with a single one, but I was wondering if there's a way to select all ending of lines at once without having to do that.
Any idea?
Thanks!