Here’s how it works for <<…>> in Sublime-Erlang. You can probably adapt this for /…/ style comments.
The first binding inserts >> when << has been typed.
{
"keys": "<"],
"command": "insert_snippet",
"args": {"contents": "<$0>>"},
"context":
{ "key": "selector", "operator": "equal", "operand": "source.erlang" },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "^<]<$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|>|]|;|\\.|\\}|$)", "match_all": true }
]
}
The second binding adds type-over for closing angle brackets.
[code]{ “keys”: “>”], “command”: “move”, “args”: {“by”: “characters”, “forward”: true}, “context”:
{ "key": "selector", "operator": "equal", "operand": "source.erlang" },
{ "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": "^>", "match_all": true }
]
}
[/code]
The third binding deletes an entire <<>> with one keypress when the cursor is in the middle.
{
"keys": "backspace"],
"command": "run_macro_file",
"args": {"file": "res://Packages/Sublime-Erlang/Delete 2 Characters Left and Right.sublime-macro"},
"context":
{ "key": "selector", "operator": "equal", "operand": "source.erlang" },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "<<$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^>>", "match_all": true }
]
}