I’m using Sublime 3. I’m trying to make a plugin that modifies some selected text. I’ve found this is a lot harder to figure out than I expected.
Following I’ve created a file ~/Library/Application Support/Sublime Text 3/Packages/User/pivot_table.py with the following:
import sublime, sublime_plugin
class PivotTable(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, 0, "Hello, World!")
I’d like to register this to run via the command palette. To do this I’ve tried creating the files ~/.sublime-commands and ~/Library/Application Support/Sublime Text 3/Packages/User/Default.sublime-commands with the following contents:
{ "caption": "Table: pivot", "command": "PivotTable" },
]
This does nothing. Could someone suggest what I did wrong?
The docs I have found are lacking. For example,
sublimetext.com/docs/3/api_reference.html appears to be incorrect in stating “Several pre-made plugins come with Sublime Text, you can find them in the Default package” because ~/Library/Application Support/Sublime Text 3/Packages/ only has a “User” folder and no “Default”.
sublime-text-unofficial-document … lette.html references a .sublime-commands file which is not noted anywhere else, and appears to not do anything.