pub enum Action {
Show 41 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),
ConvertCase(CaseMode),
SortLines(SortOptions),
TrimTrailingWhitespace,
DuplicateLine,
MoveLinesUp,
MoveLinesDown,
JoinLines,
RemoveEmptyLines {
include_whitespace: bool,
},
RemoveDuplicateLines {
consecutive_only: bool,
},
Fold,
Unfold,
ToggleFold,
FoldAll,
UnfoldAll,
FoldLevel(usize),
UnfoldLevel(usize),
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
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).
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).
Replace
Replace the primary selection if it is exactly a match, then find the next match.
ReplaceAll
Replace every match (inside the selections with “in selection”) as one undo step.
SelectAllMatches(SearchQuery)
One selection per match.
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.
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).
RemoveEmptyLines
Remove empty lines from the selected lines (all lines when nothing
is selected); with include_whitespace, also lines of only spaces
and tabs.
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.
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.