sublime插件开发教程4

写几个简单的例子详解下

import sublime
import sublime_plugin
 
 
class ExampleCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        sels = self.view.sel();
        for sel in sels:
            print(sel);

然后选中文字 输出看到如下

 

 

 

 从第8个字符到第3个字符  为什么不是(3,8)呢 因为我是从后面往前面选的

 

import sublime
import sublime_plugin
 
 
class ExampleCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        sels = self.view.sel();
        for sel in sels:
            print(sel.end());

那么输出的就是8 了

 

posted @ 2019-12-01 14:58  newmiracle宇宙  阅读(277)  评论(0编辑  收藏  举报