I am making a simple plugin, based on the rot13 example.
import sublime, sublimeplugin
def run(self, view, args):
for region in view.sel():
if not region.empty():
# Get the selected text
s = view.substr(region)
# Replace newlines
s = s.replace("\n", "\n--")
# Replace the selection with transformed text
The plugin should search for newlines in the selection, and add "--" after each newline (this is a line comment in VHDL).
I've saved the file as "CommentLines.py" in the "User" package, and it appears to compile fine:
Writing file C:\Documents and Settings\oats\Application Data\Sublime Text\Packages\User\CommentLines.py with encoding UTF-8
Reloading plugin C:\Documents and Settings\oats\Application Data\Sublime Text\Packages\User/CommentLines.py
This is my user bindings file, so that I can use ctrl+t to comment lines:
<binding key="ctrl+t" command="commentlines"/>
The plugin does not show up in the Ctrl+t does not work. Neither does running view.runCommand('commentlines') in the console. My document is unchanged. I get no errors. Not helpful. If I try to run some non-existent command, view.runCommand('nonexists') I do not get any errors either. Not helpful.
I'm running the latest beta, any ideas?