Would something like this work for you? (it will only be triggered inside “]”):
[code]import sublime, sublimeplugin
class CleanupLeftoversCommand(sublimeplugin.TextCommand):
def run(self, view, args):
sel = view.sel()[0]
a, b = sel.begin(), sel.end()
precedingChar = view.substr(sublime.Region(a - 1,a))
if precedingChar == “”:
view.runCommand(“leftDeleteCharacters”)
view.runCommand(“rightDeleteCharacters”)
else:
view.runCommand(“leftDeleteCharacters”)[/code]
<binding key="backspace" command="cleanupLeftovers">
<context name="allFollowingCharacter" value="]" />
</binding>
Just to make sure we’re on the same page!
EDIT: Posted in the wrong place… 