Skip to content

Instantly share code, notes, and snippets.

@samueleaton
Last active April 1, 2017 22:03
Show Gist options
  • Save samueleaton/ecb1ca564b103b651c12982cff50306c to your computer and use it in GitHub Desktop.
Save samueleaton/ecb1ca564b103b651c12982cff50306c to your computer and use it in GitHub Desktop.
Adds extra space between brackets when using space key in sublime text
[
{ "keys": [" "], "command": "insert_snippet", "args": {"contents": " $0 "}, "context": [
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(\\(|\\[|{) ?$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(\\)|\\]|})", "match_all": true }
]},
{ "keys": [" "], "command": "insert_snippet", "args": {"contents": "$0 "}, "context": [
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(\\(|\\[|{) $", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(\\)|\\]|})", "match_all": true }
]}
]
@samueleaton
Copy link
Author

Hitting the space bar when the cursor is between {} will produce { } with your cursor in the exact middle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment