有没有办法在Sublime Text 2中进行反向选择?
我知道您可以从Ctrl + K, Ctrl + D
跳过(Ctrl + Y
),撤消(hold alt
)和挑选(Ctrl + D
)您的选择,但我如何告诉崇高?多选反向顺序?
让我们说,而不是上升,我想要下去。
答案 0 :(得分:6)
如果有人能够改进这个插件,以便它在选择时向上滚动屏幕,那将非常感激。
注意:我为此示例选择的OSX密钥绑定与duplicate_line
冲突,因此需要为此新密钥绑定注释掉密钥绑定键绑定工作 - 否则,选择一个尚未采用的不同键绑定。
{ "keys": ["super+shift+d"], "command": "inverse_find_under_expand" },
import sublime, sublime_plugin
class InverseFindUnderExpandCommand(sublime_plugin.TextCommand):
"Add the previous occurrence of the word under the cursor to the selection"
def run(self, edit):
sel = [s for s in self.view.sel()]
new_sel = []
for s in sel:
self.view.sel().clear()
self.view.sel().add(s)
self.view.window().run_command('find_under_prev')
for ns in self.view.sel():
new_sel.append(ns)
self.view.sel().clear()
for s in sel:
self.view.sel().add(s)
for s in new_sel:
self.view.sel().add(s)