Skip to content

Instantly share code, notes, and snippets.

@jiMuBao
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiMuBao/9947388 to your computer and use it in GitHub Desktop.
Save jiMuBao/9947388 to your computer and use it in GitHub Desktop.
sublime: Key binding
How do I skip the cursor past the end of autofilled parens and braces in Sublime Text 2?
This is a small modification to Naor Ami's answer so that the autocomplete also includes curly braces and single quotes.
[
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)'}\"\\]]", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
}
]
1
Robert Gama Suggest Bio
I tried the following this morning as an option.
I turned of the auto match feature by adding the following line:
"auto_match_enabled" : false
to the settings found in: Preferences -> Settings -> User
I then created snippets for each of the bracket types by selecting Tools -> New Snippet.
Here is one of the samples:
<snippet>
<content><![CDATA[
($1)
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>(</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Now, if you type a '(' character followed by a tab, you can enter what you want in the brackets, then type tab again to move outside the bracket.
Essentially, it comes down to an extra tab press compared to what you were thinking, but at least there are no control characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment