Sublime Forum

Need to put a cursor on every selected line

#1

I am looking for a way for ST4 to individually select the the entire line of every line that I have text selected in. That is the technical description but I’m not sure it makes sense so I made a short video showing how this works.

Basically it’s like this; I select text from multiple lines and then I want Sublime to put a cursor on each of those lines and select the whole line. I want it to do this whether I put multiple cursors on every line (which that works no problem) and then when I just make a single large selection.

I use CTRL+L to open a custom macro which I have the following text in:

[
{"args":{"extend":false,"to":"bol"},"command":"move_to"},
{"args":{"extend":false,"to":"bol"},"command":"move_to"},
{"args":{"extend":true,"to":"eol"},"command":"move_to"}
]

This used to work in Sublime Text 3 for many years and I believe it broke when ST4 released. Maybe someone can specify a different way to do this that works for both selection types.

bandicam%202022-02-11%2014-41-34-297

Thanks!

0 Likes

#2

In ST3 it’s: select text, ctrl+shift+l
The command is split_selection_into_lines. (I believe)

A suggestion: bring up your default keybindings and search for “split_selection_into_lines” and see what comes up ?

0 Likes

#3

Ok I feel like a bit of a fool. You got me on the right track. Thank you!

Here is what the code SHOULD be, to do what I need. Note the first line here and omitted from the original post.

[
{"args": null, "command": "split_selection_into_lines"},
{"args": {"extend": false, "to": "bol"}, "command": "move_to"},
{"args": {"extend": false, "to": "bol"}, "command": "move_to"},
{"args": {"extend": true, "to": "eol"}, "command": "move_to"}
]
0 Likes