-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpop_selections.py
executable file
·39 lines (34 loc) · 1.31 KB
/
pop_selections.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#coding: utf8
#################################### IMPORTS ###################################
# Sublime Libs
import sublime_plugin
################################################################################
class PopSelections(sublime_plugin.TextCommand):
"""
{"args": {"forward": false},
"command": "pop_selections",
"context": [{"key": "selection_empty",
"match_all": true,
"operand": false,
"operator": "equal"},
{"key": "num_selections",
"operand": 1,
"operator": "not_equal"}],
"keys": ["ctrl+alt+shift+up"]},
{"args": {"forward": true},
"command": "pop_selections",
"context": [{"key": "selection_empty",
"match_all": true,
"operand": false,
"operator": "equal"},
{"key": "num_selections",
"operand": 1,
"operator": "not_equal"}],
"keys": ["ctrl+alt+shift+down"]}
"""
def is_enabled(self, forward):
return len(self.view.sel()) > 1
def run(self, edit, forward=True):
view = self.view
view.sel().subtract(view.sel()[0 if forward else -1])
################################################################################