-
Notifications
You must be signed in to change notification settings - Fork 47
Selection Modifiers
I've added four commands to create, add and modify the current selection:
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 |
Option | Alias | Description |
---|---|---|
--cs | --cc | Case-sensitive search |
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.
Adds the matches to the current selection. This example will add all words to the current selection.
add \w+
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. |
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 \((.*?)\)
If we want a case-sensitive selection, we can add --cs as argument:
find --cs True
will find True but ignores true and TRUE