Sublime Forum

Is there a way to expand the selection to the previous line?

#1

If I select multiple lines, I would like the ability to add the line before the selection to the selection. In other words, I’d like it to work like “expand_selection” to “line” but work backwards.

It looks to me that there are three commands that get close to what I want, but none that seem to get there.

  • expand_selection doesn’t seem to have the options to tell it to go backwards
  • select_lines adds new selections and doesn’t expand existing selections. I could use select_lines to put a selection on the previous line and then use expand_selection to “line”, but then I’d be left with multiple selections, and what I wanted was to extend the selection I have.
  • move with “extend” set is pretty close to what I want, but it only works if the caret is at the end of the selection that I want to expand. For instance, if the caret is at the beginning of my selection, I can move up with extend, and it works. If the caret is at the end of the selection, however, this doesn’t work.

Is there a way to do this short of writing a plugin? Of course, it would be a simple plugin to write, but I’m wondering if I’m missing something.

0 Likes

#2

I saw that once in https://packagecontrol.io/packages/MultiEditUtils but it’s quite an overkill.

0 Likes

#3

That looks pretty cool. I’ll have to check it out.

Thanks!

0 Likes