Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I record and run multiple find/replace with Sublime Text 2? I tried recording a macro but, as it seems, Sublime won't record find/replace, only text input etc.

share|improve this question
up vote 7 down vote accepted

Yes, Reg Replace is the way to do it. After installing that package, the way to do it is:

  1. Edit <your Sublime Text Directory>/Packages/RegReplace/reg_replace.sublime-settings (you can access this in ST2 at Preferences > Package Settings > Reg Replace > Settings – Default). Create new entries in the "replacements" object, each one being a single regex find/replace. Note that you have to doubly escape special characters. For example,

    "replacements": {
        "do_something_1": {
            "find": "\\s*\\t\\s*",
            "replace": "\\t",
            "greedy": true,
            "case": false
        "do_something_2": {
            "find": "\\n\\n+",
            "replace": "\\n",
            "greedy": true,
            "case": false
  2. String those individual replacements together into a command for the Command Palette. To do this, edit the file <your Sublime Text Directory>/RegReplace/Default.sublime-commands (Preferences > Package Settings > Reg Replace > Commands – Default). Add something like this:

            "caption": "Reg Replace: My RegEx Macro",
            "command": "reg_replace",
            "args": {
                "replacements": [

Then all you have to do is invoke the command palette by hitting Ctrl+Shift+P and browse to your newly created command.

For reference, on my Windows 7 installation, the Sublime Text directory is at C:/Users//AppData/Roaming/Sublime Text 2/

share|improve this answer
I did find a way to edit the Default.sublime-commands from the menu. Preferences -> Package Settings -> Reg Replace – Kyle Mar 18 '14 at 15:38
Aha. Post updated. – John Alexander May 21 '14 at 21:02
@JohnAlexander, Thanks. Having to figure that out on my own - was as likely to happen as getting my brain surgery degree. – mralexgray Dec 21 '15 at 5:53

You're right Sublime will not record find/replace.

However from this post on Stackoverflow, it appears you can use RegReplace.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .