pub enum Action {
Show 18 variants
Move(Motion),
Operator(Operator),
ApplyOperator {
op: Operator,
motion: Motion,
},
Edit(Edit),
ChangeMode(Mode),
Command {
name: String,
args: Vec<String>,
},
InsertChar(char),
SubmitCommand,
Undo,
Redo,
Save,
Quit,
SearchOpen(Direction),
SearchRepeat {
reverse: bool,
},
SearchWord {
reverse: bool,
},
ClearSearchHighlight,
PromptBackspace,
Pending,
}Expand description
A fully-resolved editor action — what the keymap emits, what the buffer consumes.
Variants§
Move(Motion)
Move every cursor by motion.
Operator(Operator)
Begin an operator (the d/c/y key). The editor enters
operator-pending: the next motion composes into an Action::ApplyOperator.
Resolved by the operator-pending FSM, never executed directly.
ApplyOperator
Apply a pending operator over a motion (delete-word, yank-line, etc.).
Edit(Edit)
Apply a primitive edit at each cursor.
ChangeMode(Mode)
Enter the given mode.
Command
Run a named command (via the command registry).
InsertChar(char)
Insert a character at each caret. Separate from Edit so the keymap can stay ignorant of rope details.
SubmitCommand
Submit a minibuffer / command-mode line (e.g. :w, :q).
Undo
Undo / redo one change.
Redo
Save
Save the current buffer.
Quit
Quit the editor.
SearchOpen(Direction)
Open the search prompt in direction (the / and ? keys).
The prompt reuses Mode::Command rather than adding a mode variant:
vim’s / IS the command-line with a different prompt character, and
this module’s own doc states new modes are layered through pending
state, not new variants. SearchState’s typed Option<Prompt> is what
disambiguates a <CR> that submits a search from one that submits an
ex-command — a discriminator that cannot be forgotten, unlike a bool.
SearchRepeat
n (reverse = false) / N (reverse = true) — jump to the next
match, relative to the direction the search was committed with, so N
after a ? search moves forward.
SearchWord
* (reverse = false) / # (reverse = true) — search the whole word
under the cursor. Literal, not regex: the word may contain . or [
and the user means those characters.
ClearSearchHighlight
:noh — stop highlighting matches while keeping the pattern, so n
still works. Distinct from cancelling a search.
PromptBackspace
Backspace inside a command-line or search prompt.
Key::Backspace was previously bound in NO mode, so the minibuffer could be typed into but never corrected — a typo meant Esc and start again. One action serves both prompts; the runtime routes it by whether a search prompt is open.
Pending
No-op — used when a key sequence is pending but not yet complete.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Action
Source§impl JsonSchema for Action
impl JsonSchema for Action
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more