Operator-Pending mode — entered when d, c, or y is pressed in Normal mode.
The mode waits for a motion key (or the operator repeated for a
line-wise variant) and then emits the appropriate command tuple that the
editor can execute via Minga.Editing.Operator.
State keys added by this mode
In addition to the standard :count key from Minga.Mode.state/0, the
FSM state carries:
:operator—:delete | :change | :yank— the pending operator.:op_count—pos_integer()— count accumulated before the operator key was pressed (e.g. the3in3dw). Defaults to1.:pending_g—boolean()—truewhile waiting for the secondgof agg(document-start) sequence.
Emitted commands
| Key sequence | Command(s) |
|---|---|
dw | {:delete_motion, :word_forward} |
db | {:delete_motion, :word_backward} |
de | {:delete_motion, :word_end} |
d0 | {:delete_motion, :line_start} |
d$ | {:delete_motion, :line_end} |
dgg | {:delete_motion, :document_start} |
dG | {:delete_motion, :document_end} |
dd | {:delete_lines_counted, n} |
cw | {:change_motion, :word_forward} |
cc | {:change_lines_counted, n} |
yw | {:yank_motion, :word_forward} |
yy | {:yank_lines_counted, n} |
The c* variants transition to :insert mode; all others return to :normal.
Count semantics
3dw — the count 3 is saved as :op_count when Normal mode transitions
here; after the motion w is pressed, the total repeat count is
op_count × (motion count || 1), and that many command copies are emitted.
d3w — the 3 is accumulated as the ordinary :count in this mode;
the same multiplication applies.
Text object keys
After the operator, pressing i or a enters text-object mode:
i→ inner (:inner) — stored in:text_object_modifiera→ around (:around) — stored in:text_object_modifier
The next key then selects the text object:
| Key | Object |
|---|---|
w | word (iw / aw) |
" | double-quoted string (i" / a") |
' | single-quoted string (i' / a') |
( or ) | parentheses (i( / a() |
[ or ] | brackets (i[ / a[) |
{ or } | braces (i{ / a{) |
The emitted command is {:delete_text_object, modifier, spec} (or
:change_text_object / :yank_text_object), which the editor executes by
calling the appropriate Minga.Editing.TextObject function.
Summary
Functions
Handles a key in Operator-Pending mode.
Functions
@spec handle_key(Minga.Mode.key(), Minga.Mode.state()) :: Minga.Mode.result()
Handles a key in Operator-Pending mode.
Returns a Minga.Mode.result/0.