Hi List,
I’m new to ST2 and new to Python, so forgive me: my question will be very very silly…
In the long run, I’m trying to build a plugin that (e.g.) opens the file “~/Documents/001.tex” if I ctrl-double-click inside the curly braces of “{001}”.
But as a first step, I’m trying to make a plugin that opens “~/Documents/001.tex” if the caret is inside “{001}”, say as in “{0|01}”, and mycommand is invoked.
What’s wrong with the following code?
import sublime
import sublime_plugin
class MycommandCommand(sublime_plugin.WindowCommand):
def run(self, edit):
self.view.run_command("expand_selection", {"to": "brackets"})
sel = self.view.sel()
docnum = self.view.substr(sel[0])
open_file("~/Documents/0007xx/${docnum}.tex")
Many, many thanks in advance for any help.
bblue