Created
          April 22, 2013 19:05 
        
      - 
      
- 
        Save louim/5437618 to your computer and use it in GitHub Desktop. 
    Add space around brackets and square brackets using SublimeText RegReplace
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "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 | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment