Skip to content

Selection Modifiers

Duy Dao edited this page Jul 9, 2015 · 5 revisions

I've added four commands to create, add and modify the current selection:

Commands

Command Alias Action
find search Create new selections
add   Add to the current selection
remove reduce, subtract Remove from the current selections
filter   search in selection

Options

Option Alias Description
--cs --cc Case-sensitive search

find

Clears the current selection, looks for the search term and marks them as new selections. The special thing about this command is how regex groups are handled: if the search term contains a regex-group, the group will be used for selection. As a nice side effect, this will give us the option to place the cursor anywhere we want to.

This Example will select all values inside of the attribute name, the cursor will be placed at the end of the selection. We can place the cursor at the start of the selection by using the reverse option:

find name="(.*?)" -> name="this value is selected|"

In this example, we will place the cursor at the beginning of the value, without a text selection:

find name="().*?" -> name="|this value is not selected"

As we can see, we are now able to place the cursor anywhere we want aswell as creating multiple selections with one regex.

add

Adds the matches to the current selection. This example will add all words to the current selection.

add \w+

remove

Removes the matches form the current selection. This example will remove all non-words from the current selection:

remove \s+

There are some additional shortcuts for remove:

Comamnd Action
remove lines Removes empty lines (lines containing only spaces will be count as empty).
remove leading Removes leading spaces.
remove trailing Removes trailing spaces.
remove space Removes empty lines, leading spaces and trailing spaces.

filter

The filter command acts as "find in selection". Only matched terms in the curren selection will be selected afterwards.

This example will only keep selections inside of parentheses:

filter \((.*?)\) 

Case-sensitive search

If we want a case-sensitive selection, we can add --cs as argument:

find --cs True will find True but ignores true and TRUE

Clone this wiki locally