Is there a way to do the reverse selection in Sublime Text 2?
I know that you can skip (Ctrl + K, Ctrl + D
), undo (Ctrl + Y
) and cherry pick (hold alt
) your selection from Ctrl + D
but how do I tell sublime to multi-select in reverse order?
Let's say, instead of going up to down, I want to go down to up.
If anyone can please improve upon this plugin so that it scrolls the screen upwards as it selects, that would be greatly appreciated.
NOTE: The OSX key binding that I chose for this example conflicts with duplicate_line
, so that key binding would need to be commented out for this new key binding to work -- otherwise, select a different key binding that is not already taken.
{ "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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With