There is view.sel() but I can’t figure out how to use it. Using the following codes as example, how do you make it work only in selection of text?
class FoobarCommand(sublime_plugin.TextCommand):
def run(self, edit):
str = self.view.find_all(" foo ")
str.reverse()
for r in str:
self.view.erase(edit, r)