Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 79 variants InsertText(String), Paste(String), InsertTab, InsertNewline, DeleteBackward, DeleteForward, DeleteWordBackward, DeleteWordForward, MoveCursor { motion: Motion, extend: bool, }, SelectAll, SelectWord, SelectLine, AddCursorAbove, AddCursorBelow, CollapseSelections, SetSelections(SelectionSet), ColumnSelect { anchor_line: usize, anchor_col: VisualCol, head_line: usize, head_col: VisualCol, }, ColumnExtend(Direction), PasteBlock(String), Find { query: SearchQuery, backward: bool, }, Replace { query: SearchQuery, replacement: String, }, ReplaceAll { query: SearchQuery, replacement: String, }, SelectAllMatches(SearchQuery), MultiSelectNext { match_case: bool, whole_word: bool, }, MultiSelectAll { match_case: bool, whole_word: bool, }, ConvertCase(CaseMode), SortLines(SortOptions), ShuffleLines { seed: u64, }, TrimTrailingWhitespace, DuplicateLine, MoveLinesUp, MoveLinesDown, JoinLines, SplitLines { width: usize, }, RemoveEmptyLines { include_whitespace: bool, }, RemoveDuplicateLines { consecutive_only: bool, }, DeleteLine, TransposeLines, InsertLineAbove, InsertLineBelow, ReverseLines, TrimLeadingWhitespace, TrimLeadingAndTrailingWhitespace, EolToSpace, TabsToSpaces, SpacesToTabs, ColumnInsert(ColumnInsert), Fold, Unfold, ToggleFold, FoldAll, UnfoldAll, FoldLevel(usize), UnfoldLevel(usize), GoToLine { line: usize, column: usize, }, Indent, Unindent, ToggleLineComment, CommentLines, UncommentLines, ToggleBlockComment, ConvertIndentation { to_spaces: bool, }, GoToMatchingBracket, SelectToMatchingBracket, FormatJson { indent: Option<Indent>, }, MinifyJson, Encode(Codec), Decode(Codec), ToggleBookmark, NextBookmark, PrevBookmark, ClearBookmarks, InverseBookmarks, BookmarkMatches(SearchQuery), RemoveBookmarkedLines, RemoveUnbookmarkedLines, ReplaceBookmarkedLines(String), Undo, Redo,
}

Variants§

§

InsertText(String)

§

Paste(String)

Like InsertText, but when there are several selections and the text has exactly that many lines, each selection gets one line.

§

InsertTab

Tab key: a tab character, or spaces to the next tab stop when the editor is set to indent with spaces.

§

InsertNewline

Newline plus the current line’s leading whitespace (auto-indent).

§

DeleteBackward

§

DeleteForward

§

DeleteWordBackward

§

DeleteWordForward

§

MoveCursor

Fields

§motion: Motion
§extend: bool
§

SelectAll

§

SelectWord

§

SelectLine

§

AddCursorAbove

§

AddCursorBelow

§

CollapseSelections

Collapse to a caret at the primary selection’s head.

§

SetSelections(SelectionSet)

Replace the selections (mouse clicks and drags). Positions are clamped into the document and onto char boundaries.

§

ColumnSelect

Rectangular selection in visual columns: one selection per line from the anchor corner to the head corner. Lines shorter than the rectangle get an empty selection at their end (no virtual space).

Fields

§anchor_line: usize
§anchor_col: VisualCol
§head_line: usize
§head_col: VisualCol
§

ColumnExtend(Direction)

Grow or shrink the rectangle by moving its head corner (Alt+Shift+ arrows); starts a rectangle at the primary caret if there is none.

§

PasteBlock(String)

Paste a rectangular clip: line i goes to the caret’s visual column on the i-th line below it, padding short lines with spaces and adding lines at the end of the document as needed. With several selections or a non-empty one it behaves like Paste.

§

Find

Select the next (or previous) match after the primary selection. Fails with NotFound when there is none (macros stop there).

Fields

§backward: bool
§

Replace

Replace the primary selection if it is exactly a match, then find the next match.

Fields

§replacement: String
§

ReplaceAll

Replace every match (inside the selections with “in selection”) as one undo step.

Fields

§replacement: String
§

SelectAllMatches(SearchQuery)

One selection per match.

§

MultiSelectNext

Multi-select Next: add the next occurrence of the primary selection’s text (after it, going round from the end) as a new primary selection. With a caret, select the word at it first.

Fields

§match_case: bool
§whole_word: bool
§

MultiSelectAll

Multi-select All: a selection on every occurrence of the primary selection’s text (or of the word at the caret).

Fields

§match_case: bool
§whole_word: bool
§

ConvertCase(CaseMode)

Convert each selection (or the caret’s line) to a case.

§

SortLines(SortOptions)

Sort the selected lines, the rectangle’s lines keyed by the text in the rectangle, or the whole document when nothing is selected.

§

ShuffleLines

Put the lines Sort Lines would sort in a random order (Randomize Line Order); the seed decides the order, so a macro replays it.

Fields

§seed: u64
§

TrimTrailingWhitespace

Remove trailing spaces and tabs from the selected lines (all lines when nothing is selected).

§

DuplicateLine

Duplicate the caret’s line, or each selection.

§

MoveLinesUp

§

MoveLinesDown

§

JoinLines

Join the selected lines (or the caret’s line and the next).

§

SplitLines

Split each selected line (or the caret’s line) wider than width columns at the blanks between words, as Notepad++’s Split Lines; the new lines start with the line’s indentation.

Fields

§width: usize
§

RemoveEmptyLines

Remove empty lines from the selected lines (all lines when nothing is selected); with include_whitespace, also lines of only spaces and tabs.

Fields

§include_whitespace: bool
§

RemoveDuplicateLines

Remove lines equal to an earlier selected line (all lines when nothing is selected), keeping the order; with consecutive_only, only lines equal to the line right before them.

Fields

§consecutive_only: bool
§

DeleteLine

Delete the lines the selections touch (the caret’s line), with their line breaks: Notepad++’s Line Delete (Ctrl+Shift+L).

§

TransposeLines

Swap each caret’s line with the line above it (Ctrl+T); the caret goes to the start of its line, as in Notepad++.

§

InsertLineAbove

Insert a line above each caret’s line (a selection’s first line), indented like it, and move the caret there (Ctrl+Alt+Enter).

§

InsertLineBelow

Insert a line below each caret’s line (a selection’s last line), indented like it, and move the caret there (Ctrl+Alt+Shift+Enter).

§

ReverseLines

Reverse the order of the selected lines (every line when nothing is selected).

§

TrimLeadingWhitespace

Remove leading spaces and tabs from the selected lines (all lines when nothing is selected).

§

TrimLeadingAndTrailingWhitespace

Remove leading and trailing spaces and tabs from the selected lines (all lines when nothing is selected).

§

EolToSpace

Replace the line breaks between the selected lines (all lines) with spaces, keeping the blanks around them.

§

TabsToSpaces

Replace every tab on the selected lines (all lines) with spaces to the same tab stop.

§

SpacesToTabs

Replace spaces with tabs on the selected lines (all lines) wherever the columns stay the same: the indentation, and runs of two or more spaces reaching a tab stop.

§

ColumnInsert(ColumnInsert)

The Column Editor: insert text or a number sequence at one column on many lines (see ColumnInsert).

§

Fold

Fold the region holding the caret: the caret’s line if it starts a region, else the innermost region around it. Fold actions change the view only (no undo step) and are not recorded in macros.

§

Unfold

Unfold the caret’s line, or every fold inside the region around it.

§

ToggleFold

Unfold the caret’s line if it is folded, else Fold.

§

FoldAll

§

UnfoldAll

§

FoldLevel(usize)

Fold every region of this level: the nesting depth for indentation (1 is outermost), the heading level in Markdown.

§

UnfoldLevel(usize)

§

GoToLine

Move the caret to a line and visual column, both counted from 1 as in the status bar (column 1 is the line start).

Fields

§line: usize
§column: usize
§

Indent

Indent the selected lines, or the caret’s line, by one level (Tab does this only when a selection spans lines).

§

Unindent

Shift+Tab: remove one level of indentation from the selected lines, or the caret’s line. (Tab with a selection over several lines indents them.)

§

ToggleLineComment

Comment the selected lines (or the caret’s line) with the language’s line comment, or uncomment them if they all are. Languages with only block comments get a block comment around the lines.

§

CommentLines

Comment the selected lines (or the caret’s line) even if they already are, as Notepad++’s Single Line Comment. Languages with only block comments get a block comment around the lines unless they are in one.

§

UncommentLines

Remove one line comment from each selected line that has one (or the block comment around the lines), as Notepad++’s Single Line Uncomment. Other lines are left alone.

§

ToggleBlockComment

Wrap each selection (or the caret’s line) in a block comment, or unwrap it.

§

ConvertIndentation

Rewrite every line’s leading whitespace as spaces or as tabs, keeping its width, and indent with that from now on.

Fields

§to_spaces: bool
§

GoToMatchingBracket

Move the caret to the bracket matching the one beside it.

§

SelectToMatchingBracket

Select from the bracket beside the caret to its match, both included.

§

FormatJson

Pretty-print the JSON in each selection, or the whole document when nothing is selected: one member or element per line, indented with indent (the document’s indentation when None). Key order, numbers and strings are kept exactly. Fails on invalid JSON.

Fields

§indent: Option<Indent>
§

MinifyJson

Remove the whitespace between the JSON tokens of each selection (or the whole document).

§

Encode(Codec)

Encode each selection, or the whole document when nothing is selected, as UTF-8 with the document’s line endings.

§

Decode(Codec)

Decode each selection (or the whole document). Fails when it is not valid or the bytes are not UTF-8 text.

§

ToggleBookmark

Bookmark each caret’s line, or remove the bookmarks if every one of those lines has one (Ctrl+F2). Bookmarks belong to the document; changing them is not an undo step.

§

NextBookmark

Move the caret to the start of the next bookmarked line, wrapping around to the first (F2).

§

PrevBookmark

Move the caret to the start of the previous bookmarked line, wrapping around to the last (Shift+F2).

§

ClearBookmarks

Remove every bookmark.

§

InverseBookmarks

Bookmark every line without a bookmark, and remove the others.

§

BookmarkMatches(SearchQuery)

Bookmark every line holding the start of a match (in the selections with “in selection”), keeping the bookmarks already there.

§

RemoveBookmarkedLines

Delete the bookmarked lines with their line breaks.

§

RemoveUnbookmarkedLines

Delete every line without a bookmark.

§

ReplaceBookmarkedLines(String)

Replace the text of each bookmarked line (not its line break) with this text: Paste to (Replace) Bookmarked Lines.

§

Undo

§

Redo

Implementations§

Source§

impl Action

Source

pub fn is_recordable(&self) -> bool

Whether the macro recorder keeps this action. Mouse-made selections (absolute positions) and undo/redo are left out, as in Notepad++.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Self

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

Source§

fn eq(&self, other: &Self) -> 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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.