blob: 49b8fe5bdbb2a238fe223cabb66c387cf120479d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import sublime
import sublime_plugin
class SelectOnlyUniqueCommand(sublime_plugin.TextCommand):
def run(self, edit):
new_sels = []
found_texts = set()
for r in self.view.sel():
text = self.view.substr(r)
if text not in found_texts:
found_texts.add(text)
new_sels.append((r.a, r.b))
self.view.sel().clear()
self.view.sel().add_all([
sublime.Region(a, b)
for a, b in new_sels
])
|