Search code examples
sublimetext2sublimetextmultipleselection

Sublime Text: Multiple Select in a Selection


I want to do multiple select and edit within a specified selection in Sublime Text 2. The following screenshot illustrates the situation:

enter image description here

When I select "element" and press Alt + F3 (in Windows) I can simultaneously edit all instances of element. However what I would like to do is to be able to edit all instances of element only within container-a while leaving element within container-b untouched. I tried first selecting a specific area but then as soon as I attempt to select "element" my first selection disappears.

Is this possible to achieve in Sublime Text 2?


Solution

  • You can simply use the Find in Selection option in the Find panel. Select the text that you want to search in:

    selection

    then hit CtrlF to open the Find panel. Type in the text you want to find (such as element), then, in the group of buttons to the left of the text area, click the second button from the right - In Selection (highlighted in red):

    Find In Selection

    Finally, either hit AltEnter or click Find All to select all the instances of element in the selected area:

    found

    and you're good to go.