Sorry for my ignorance. I just started trying SublimeText so far, and like it a lot. But I really want tag closing.
This is what I did:
1) Went to Tools > New Plugin, and pasted in this:
import sublime, sublime_plugin, re
def run(self, edit ):
leftOfCursor = self.view.substr(sublime.Region(0, self.view.sel().begin()))
regex = re.compile('<(/?\w+)^>]*>')
tags = regex.findall(leftOfCursor)
opentags = ]
for tag in tags:
if tag == '/':
if opentags-1] == tag[1:]: opentags.pop()
if len(opentags) > 0:
tag = '</' + opentags-1] + '>'
self.view.insert(edit, self.view.sel().begin(), tag)
I then saved it to the default plugin directory: C:\Users\~\AppData\Roaming\Sublime Text\Packages
2) I then went to Preference > User Key Bindings, and pasted in the command I found here like this:
Place your key bindings in here, this will ensure they don't get overwritten
when installing new versions of Sublime Text
<binding key="ctrl+period" command="closeTag"/>
Hitting Ctrl + . does not do anything though. And nothing shows up in the console when I do.
How can I make this work? Thanks