Sublime Forum

Find Copy Replace?

#1

I want to be able to find certain lines, copy them, add the copy right below the existing line, with one word changed. For example:

Feature: 2010/03/picture.jpg

I want this to become:

Feature: 2010/03/picture.jpg
Teaser: 2010/03/picture.jpg

Is there any way to do this in Sublime Text 3? If not, is there another text editor where I can achieve this?

0 Likes

#2

I just attempted to create a macro to do this function. Unfortunately when I select Tools > Save Macro… I am not presented with an opportunity to name the macro, and I don’t find any new macros under Tools > Macros.

So how am I supposed to achieve this?

0 Likes

#3

It’s probably because find action is unfortunately not recorded in macro.
You probably have to use a plugin to do what you want.
Note that you can call a macro from a plugin using “run_macro_file”, so you can write a macro to do the inserting job and use the API to only put the cursors in the starting place.

0 Likes

#4

You can do this with a regular expression replace (.*) button pressed

Find What: ^Feature:(.*)$
Replace with; Feature:\1\nTeaser:\1\n

Then replace all.

0 Likes