I'm often copying and pasting code from further up in my document but I want to change just one variable name. Is the a command like ATL F3 that select all instances of the currently highlighted word but only inside the current screen area?
Thanks.
import sublime, sublimeplugin
class CropVisibleSelectionCommand(sublimeplugin.TextCommand):
"""
Deselects anything that is not currently visible
"""
def run(self, view, args):
mask1 = sublime.Region(0, view.visibleRegion().begin())
mask2 = sublime.Region(view.visibleRegion().end(), view.size())
view.sel().subtract(mask1)
view.sel().subtract(mask2)
import sublime, sublimeplugin
class HiddenSelectionInfo(sublimeplugin.Plugin):
def onSelectionModified(self, view):
hidden = 0
visible = view.visibleRegion()
for region in view.sel():
if not region.intersects(visible):
hidden += 1
if hidden > 0:
view.setStatus('hiddenRegions', "%i hidden region%s" % (hidden, 's' if hidden > 1 else ''))
else:
view.eraseStatus('hiddenRegions')
Users browsing this forum: No registered users and 8 guests