Skip to main content

Action

Enum Action 

Source
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.).

Fields

§motion: Motion
§

Edit(Edit)

Apply a primitive edit at each cursor.

§

ChangeMode(Mode)

Enter the given mode.

§

Command

Run a named command (via the command registry).

Fields

§name: String
§args: Vec<String>
§

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.

Fields

§reverse: bool
§

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.

Fields

§reverse: bool
§

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 Clone for Action

Source§

fn clone(&self) -> Action

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Action

Source§

impl JsonSchema for Action

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.