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.
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.
For your usecase I would recommend pressing “ctrl+d” a few times.
Here’s a plugin that will deselect anything that isn’t currently visible:
[code]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)
[/code]
And here’s a plugin that will put info in the status bar about how many invisible selection regions there are:
[code]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')
[/code]