Sublime Forum

How do a collapse parts of multiple lines

#1

I noticed that Ctrl+shift+ can be used to collapse something I’ve selected with sublime text

So, if I have a line
command("",executeCommand,…many… parameters)

I can select just the parameters to the function command and collapse\fold it. My question is, what if I have 50 lines of this? Ie

command("",executeCommand,…many… parameters)
command("",executeCommand,…many… parameters)
command("",executeCommand,…many… parameters)
command("",executeCommand,many,parameters)
command("",executeCommand,1 param)

How can I quickly select and collapse all of the parameters in this case?

0 Likes

#2

click on the first executeCommand
press cmd+d 49 times
press cmd+shift+right (or shift+end)
collapse it all with your collapse shortcut.

Sublime Text has really good multiple selection support.

0 Likes

#3

Here’s another way:

select all 50 lines (with the mouse, maybe?)
hit cmd+shift+l
hit cmd+left (or Home, I guess, if you’re on Windows)
hit option+right (ctrl+right?) a couple times
then press cmd+shift+right or shift+End, as above, and collapse it.

0 Likes

#4

Assuming you aren’t being picky, you can select the first executeCommand and then expand the selection to the rest with Quick Find All (Alt+F3 on Win/Linux; not sure on OSX.).

0 Likes

#5

Heck yeah! Thanks guys

I went with select, alt-F3, right arrow into params shift+end, shift-left arrow to unselect semicolon, ctrl+shift+

I even convinced a coworker to adopt sublime in the process.

0 Likes