First I was getting the no module error "ImportError: No module named sublimeplugin" with
import sublime, sublimeplugin and class Rot13Command(sublimeplugin.TextCommand):
Though running view.run_command('rot13') worked(or did earlier anyway though doesn't now).
Then I added an _
Then, that got rid of the "no module..." error
When I enter this command in the console- view.run_command('rot13')
I get this error "TypeError: run() takes exactly 3 arguments (2 given)"
Below is my code just taken from that link but adding an underscore, how can I fix that error?
- Code: Select all
import sublime, sublime_plugin
def run(self, view, args):
for region in view.sel():
if not region.empty():
# Get the selected text
s = view.substr(region)
# Transform it via rot13
s = s.encode('rot13')
# Replace the selection with transformed text