Skip to content

Instantly share code, notes, and snippets.

@louim
Created April 22, 2013 19:05
Show Gist options
  • Save louim/5437618 to your computer and use it in GitHub Desktop.
Save louim/5437618 to your computer and use it in GitHub Desktop.

Revisions

  1. louim created this gist Apr 22, 2013.
    42 changes: 42 additions & 0 deletions reg_replace.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    {
    "replacements": {
    "add_space_around_opening_brackets": {
    "find": "\\((?! |\\)|\\n)",
    "replace": "( ",
    "greedy_scope": true,
    "scope_filter": ["source.js,source.php","-comment", "-string.regexp", "-string.quoted.single.php", "-string.quoted.double.php"]
    },
    "add_space_around_closing_brackets": {
    "find": "(?<! |\\(|\\t)\\)",
    "replace": " )",
    "greedy_scope": true,
    "scope_filter": ["source.js,source.php","-comment", "-string.regexp", "-string.quoted.single.php", "-string.quoted.double.php"]
    },
    "add_space_around_square_opening_brackets": {
    "find": "\\[(?! |\\]|P|\\n)",
    "replace": "[ ",
    "greedy_scope": true,
    "scope_filter": ["source.js,source.php","-comment", "-string.regexp", "-string.quoted.single.php", "-string.quoted.double.php"]
    },
    "add_space_around_square_closing_brackets": {
    "find": "(?<! |\\[|H|\\t)\\]",
    "replace": " ]",
    "greedy_scope": true,
    "scope_filter": ["source.js,source.php","-comment", "-string.regexp", "-string.quoted.single.php", "-string.quoted.double.php"]
    }
    },
    "on_save": true,
    "on_save_sequences": [
    {
    "file_pattern": ["*.js", "*.php", "*.ctp"],
    "sequence": [
    "add_space_around_opening_brackets",
    "add_space_around_closing_brackets",
    "add_space_around_square_opening_brackets",
    "add_space_around_square_closing_brackets",
    "remove_trailing_spaces"
    ]
    }
    ],
    "results_in_panel": true
    }