Sublime Forum

Simple Macro Question

#1

Having fallen in love with sublime for all my coding needs, I’m running up against a wall with a new contract I have going.

I am doing a ton of PDF to HTML conversion, and a major part of this process is the cleanup that I’d like to be able to do in Sublime.

To the end, is there a way to write a simple macro to find and replace a number of different things? Or even just one thing?

In example, I’d love to be able to macro this:
Find: <P\n\n>
Replace with:

Find: <Font.*?>
Replace with: (nothing so it deletes)

Any thoughts? I’ve watched a few macro videos read through the commands help sheets and tried to record one of my own, but it isn’t clear how to get the argument into the macro.

Thank you for any help you can give. I love sublime and am very happy with my purchase so far.

0 Likes

#2

I don’t believe we can record a macro to perform specific replacements - it can only initiate the Find/Replace feature.

You could create a (Python) TextCommand to achieve this, but I think the RegReplace plugin might achieve what you’re looking for. It’s available via PackageControl.

I haven’t used this plugin myself, but a quick look tells me that you can use the option ‘literal’ to perform non-regex replacements, if this is your preference.

0 Likes