Sublime Forum

Text processing, macros and looping

#1

Hi all,
Note: I’m new to python and also sublime /macros etc so sry if this is a very simple / complicated question…

I’m trying to do some text processing via macros, I’d like to copy some text into the text editor and then process each line that has been pasted ie:

for the first line I would do an insert snippet command (

${<0:$SELECTION}

) - (requires knowing beginning line number when pasted)

for the rest of each line pasted i would do another insert snippet command (

${<0:$SELECTION}

) until i reach the end of all the pasted lines - (requires knowing last pasted line number)

I’m am not sure how I go about doing this but it looks like I need to somehow get the line number before pasting and then get the line number after pasting. this would then supposedly let me loop the number of lines pasted and do some commands for each… but how??

If some could help it would be much appreciated,
many thanks :smile:

0 Likes