Sublime Forum

Playback Macro to the end of file

#1

Is there a way to do multiple playback of a macro, and ideally to the end of the file?

0 Likes

#2

I don’t think is possible right now to play macro to EOF :frowning:

0 Likes

#3

Can you play a macro multiple times?

0 Likes

#4

You can generally use multiple selections to do this:

Press Ctrl+A to select the entire file
Press Ctrl+Shift+L to split the selection into n selections, one per line
Press home to move each selection to just the beginning of the line
Playback the macro

0 Likes

#5

Brilliant!!! Worth the price of admission.

0 Likes

#6

Glad you like it :slight_smile:

You generally don’t need macros at all with multiple selection, it’s often simpler just to make the selections on the lines you’re interested in, and do the editing directly.

0 Likes

#7

[quote=“jps”]Glad you like it :smile:

You generally don’t need macros at all with multiple selection, it’s often simpler just to make the selections on the lines you’re interested in, and do the editing directly.[/quote]

Yup, I use macros more for repeated stuff that requires more than 3 steps, or for shortcuts to stuff just to be lazy :stuck_out_tongue:
Multiselections are a God’s send :smiley:

0 Likes

#8

I do not think this would work in case you have a task like deleting alternate lines… :expressionless:

0 Likes

#9

so don’t use a macro for it - a simple regex or Python plugin would suffice…

Find: (?:\G.*$\n(.*$\n))+
Replace: $1

:boom:

1 Like

#10

Though there are workarounds for some operations, sometimes Macros to record a sequence of operations together with a ‘Repeat’ function (x times or to EOF) are the best way. I’ve found many situations where multi-cursors don’t fit and I usually have to fire another editor in such cases.

This would be especially useful if macros could record everything - like Find for example :wink:

0 Likes

#11

https://packagecontrol.io/packages/Repeat%20Macro

1 Like