Sublime Forum

Column selection after end of line

#1

I start with this text

apple orange pear

I want to add “= 0” to the end of each line. Moreover I want the equal sign to be aligned.

apple = 0 orange = 0 pear = 0

I am trying to use multiple select after the end of each line. The problem is the cursor cannot move beyond the end of the line. So the multiple selection end up unaligned.

apple| orange| pear|

Is there anyway to get the selection aligned on a column after the end of line like this?

apple | orange | pear |

0 Likes

#2

[quote=“tungwaiyip”]Is there anyway to get the selection aligned on a column after the end of line like this?

apple | orange | pear | [/quote]

I don’t have a general solution for you, but in this case with a suitable tab stop setting (I use 4) you can just multi-select, press Tab and then your text and you’ll get the alignment you want. Or if you are prepared count keystrokes: multi-select, add enough spaces so that the cursor for the shortest word is positioned after the end of the longest word, press Home to align all the cursors then navigate right to position the now-aligned cursors after the end of the longest word but before any ‘=’ character, then shift select the space between the cursors and the ‘=’ character and delete.

If this is just a one-off, sometimes it’s easier to automate to something that is almost correct and manually fix up a few errors than to either do the whole thing manually or spend time programming to get the automation perfect. Of course, if this is something you are going to do a lot, you will need something more sophisticated. But with a heavily programmable editor, sometimes we forget that low-tech solutions can sometimes still be useful.

0 Likes

#3

On day three of trying out sublime text.

I am also looking for this feature.
Seem to remember that in the editors I have abandoned it is done automatically by setting a flag in the preferences (fill white space on column select). Does such a setting exist?

Failing that is there a plug in to do this for sublime text 3 (Ubuntu)?

Pressing tab doesn’t align the text you want to add in and counting spaces is somewhat tedious and time consuming.

Thanks in advance.

0 Likes

#4

one could consider using a plugin like https://packagecontrol.io/packages/AlignTab to help with this

0 Likes