@@ -30,23 +30,39 @@ def cursorless_simple_modifier(m) -> dict[str, str]:
30
30
}
31
31
32
32
33
- modifiers = [
34
- "<user.cursorless_position>" , # before, end of
33
+ # These are the modifiers that will be "swallowed" by the head/tail modifier.
34
+ # For example, saying "head funk" will result in a "head" modifier that will
35
+ # select past the start of the function.
36
+ # Note that we don't include "inside" here, because that requires slightly
37
+ # special treatment to ensure that "head inside round" swallows "inside round"
38
+ # rather than just "inside".
39
+ head_tail_swallowed_modifiers = [
35
40
"<user.cursorless_simple_modifier>" , # bounds, just, leading, trailing
36
- "<user.cursorless_interior_modifier>" , # inside
37
- "<user.cursorless_head_tail_modifier>" , # head, tail
38
41
"<user.cursorless_containing_scope>" , # funk, state, class
39
42
"<user.cursorless_subtoken_scope>" , # first past second word
40
43
"<user.cursorless_surrounding_pair>" , # matching/pair [curly, round]
41
44
]
42
45
46
+ modifiers = [
47
+ "<user.cursorless_position>" , # before, end of
48
+ "<user.cursorless_interior_modifier>" , # inside
49
+ "<user.cursorless_head_tail_modifier>" , # head, tail
50
+ * head_tail_swallowed_modifiers ,
51
+ ]
52
+
43
53
44
54
@mod .capture (rule = "|" .join (modifiers ))
45
55
def cursorless_modifier (m ) -> str :
46
56
"""Cursorless modifier"""
47
57
return m [0 ]
48
58
49
59
60
+ @mod .capture (rule = "|" .join (head_tail_swallowed_modifiers ))
61
+ def cursorless_head_tail_swallowed_modifier (m ) -> str :
62
+ """Cursorless modifier that is swallowed by the head/tail modifier, excluding interior, which requires special treatment"""
63
+ return m [0 ]
64
+
65
+
50
66
def on_ready ():
51
67
init_csv_and_watch_changes (
52
68
"modifiers" ,
0 commit comments