14


崇高なテキスト 3 のプラグインを作成しようとしています。
今のところ、ウィンドウ内のすべてのテキストを選択して別のウィンドウにコピーすることしかできません。
コード :

import sublime, sublime_plugin

class PrintCodeCommand(sublime_plugin.WindowCommand):
    def run(self):
        # for each caracter, add it to a string with the substr method
        s = ""
        for x in range(0,self.window.active_view().size()):
            s += self.window.active_view().substr(x)
        newFile = self.window.new_file()
        newFile.run_command("test",{"textBuffer": s})

class Test(sublime_plugin.TextCommand):
    def run(self, edit, textBuffer):
        self.view.insert(edit, 0, textBuffer)

そうするためのより良い/より簡単な方法を知っていますか?
ありがとう!

4

1 に答える 1