Home Download Buy Blog Forum Support

Modifying autocompletes

Modifying autocompletes

Postby danielmurphy on Mon Feb 25, 2013 7:36 pm

Hi-

I'd like to modify ST to add spaces between curly braces when it auto closes them.

Currently, when you type '{' ST automatically adds the closing '}' What I would like is to have it automatically insert two spaces between the braces, with my cursor right in the middle.

Is this possible?


Thanks!
danielmurphy
 
Posts: 2
Joined: Mon Feb 25, 2013 7:33 pm

Re: Modifying autocompletes

Postby C0D312 on Mon Feb 25, 2013 8:49 pm

In the default keybindings, you'll find:
Code: Select all
   // Auto-pair curly brackets
   { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context":
      [
         { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
         { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
         { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true }
      ]
   }


replace {$0} with { $0 }

(Make sure to put the changes in your user keybindings)
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Modifying autocompletes

Postby danielmurphy on Mon Feb 25, 2013 9:12 pm

Perfect! Thanks!
danielmurphy
 
Posts: 2
Joined: Mon Feb 25, 2013 7:33 pm


Return to General Discussion

Who is online

Users browsing this forum: BestGreek and 15 guests