How can I do this?
I put
{ "keys": "f1"], "command": "open_file", "args": {"filename": "index.php"} }
I struggle with sublime API and open_file but nothing works and I can’t debug it. It always returns nothing.
For example, I thought it will work. I was wrong. =)
import sublime, sublime_plugin
import os
class open_fileCommand(sublime_plugin.WindowCommand):
def run(self):
v = self.window.new_file()
v.settings().set('default_dir',
os.path.join(sublime.packages_path(), 'User'))
v.set_syntax_file('Packages/JavaScript/JSON.tmLanguage')
v.set_name('untitled.sublime-build')
template = """{
"cmd": "${0:make}"]
}
"""
v.run_command("insert_snippet", {"contents": template})