写几个简单的例子详解下



import sublime
import sublime_plugin


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


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

sublime插件开发教程4_公众号

 

 sublime插件开发教程4_javascript_02

 

 从第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 了