There is this example http://stackoverflow.com/a/18656619/4934640
import os, sublime_plugin
class CmdCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_name = self.view.file_name()
command = "cd " + file_name + " & start cmd"
os.system(command)
I do not see any means how does the command “cmd” is found out by sublime and run the CmdCommand
class method run(2).
Context.sublime-menu:
[
{ "command": "cmd" }
]
How may I create my custom command like this:
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{ "caption": "Force Re-write Sublime Settings", "command": "force_reload_sublime_settings" },
]
}
]
I may just run sublime.save_settings('Preferences.sublime-settings')
on the Sublime Text console. But how to create a plugin to accomplish so? Something like this:
import os, sublime_plugin
class CmdCommand(sublime_plugin.TextCommand):
def run(self, edit):
view.run_command( "sublime.save_settings('Preferences.sublime-settings')" )