#[non_exhaustive]pub enum Action<I: ApplicationInfo = EmptyInfo> {
Show 17 variants
NoOp,
Editor(EditorAction),
Macro(MacroAction),
Jump(PositionList, MoveDir1D, Count),
Repeat(RepeatType),
Scroll(ScrollStyle),
KeywordLookup(KeywordTarget),
RedrawScreen,
ShowInfoMessage(InfoMessage),
Suspend,
Search(MoveDirMod, Count),
Command(CommandAction),
CommandBar(CommandBarAction<I>),
Prompt(PromptAction),
Tab(TabAction<I>),
Window(WindowAction<I>),
Application(I::Action),
}Expand description
The result of either pressing a complete keybinding sequence, or parsing a command.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoOp
Do nothing.
§Example: Using action!
use editor_types::{action, Action};
// All of these are equivalent:
let noop: Action = Action::NoOp;
assert_eq!(action!("nop"), noop);
assert_eq!(action!("noop"), noop);
assert_eq!(action!("no-op"), noop);
assert_eq!(Action::default(), noop);Editor(EditorAction)
Perform an editor action.
See the documentation for the EditorAction variants for how to construct all of the different Action::Editor values using action.
Macro(MacroAction)
Perform a macro-related action.
See the documentation for the MacroAction variants for how to construct all of the different Action::Macro values using action.
Jump(PositionList, MoveDir1D, Count)
Navigate through the cursor positions in the specified list.
If the current window cannot satisfy the given Count, then this may jump to other windows.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, InsertTextAction};
let list = PositionList::JumpList;
let count = Count::Contextual;
let act: Action = Action::Jump(list, MoveDir1D::Next, count.clone());
assert_eq!(act, action!("jump -t jump-list -d next -c ctx"));
let act: Action = Action::Jump(list, MoveDir1D::Previous, count);
assert_eq!(act, action!("jump -t jump-list -d previous -c ctx"));Repeat(RepeatType)
Repeat an action sequence with the current context.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let rep: Action = action!("repeat -s edit-sequence");
assert_eq!(rep, Action::Repeat(RepeatType::EditSequence));See the RepeatType documentation for how to construct each of its variants.
Scroll(ScrollStyle)
Scroll the viewport in the specified manner.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let scroll: Action = Action::Scroll(
ScrollStyle::LinePos(MovePosition::Beginning, 1.into()));
assert_eq!(scroll, action!("scroll -s (line-pos -p beginning -c 1)"));See the ScrollStyle documentation for how to construct each of its variants.
KeywordLookup(KeywordTarget)
Lookup the keyword under the cursor.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action};
let kw: Action = Action::KeywordLookup(KeywordTarget::Selection);
assert_eq!(kw, action!("keyword-lookup -t selection"));RedrawScreen
Redraw the screen.
§Example: Using action!
use editor_types::{action, Action};
let redraw: Action = action!("redraw-screen");
assert_eq!(redraw, Action::RedrawScreen);ShowInfoMessage(InfoMessage)
Show an InfoMessage.
Suspend
Suspend the process.
§Example: Using action!
use editor_types::{action, Action};
let suspend: Action = action!("suspend");
assert_eq!(suspend, Action::Suspend);Search(MoveDirMod, Count)
Find the nth occurrence of the current application-level search.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, CommandBarAction};
let search: Action = action!("search -d same");
assert_eq!(search, Action::Search(MoveDirMod::Same, Count::Contextual));See the documentation for MoveDirMod for how to construct all of its values using action.
Command(CommandAction)
Perform a command-related action.
See the documentation for the CommandAction variants for how to construct all of the different Action::Command values using action.
CommandBar(CommandBarAction<I>)
Perform a command bar-related action.
See the documentation for the CommandBarAction variants for how to construct all of the different Action::CommandBar values using action.
Prompt(PromptAction)
Perform a prompt-related action.
See the documentation for the PromptAction variants for how to construct all of the different Action::Prompt values using action.
Tab(TabAction<I>)
Perform a tab-related action.
See the documentation for the TabAction variants for how to construct all of the different Action::Tab values using action.
Window(WindowAction<I>)
Perform a window-related action.
See the documentation for the WindowAction variants for how to construct all of the different Action::Window values using action.
Application(I::Action)
Application-specific command.
Implementations§
Source§impl<I: ApplicationInfo> Action<I>
impl<I: ApplicationInfo> Action<I>
Sourcepub fn is_edit_sequence(
&self,
motion: SequenceStatus,
ctx: &EditContext,
) -> SequenceStatus
pub fn is_edit_sequence( &self, motion: SequenceStatus, ctx: &EditContext, ) -> SequenceStatus
Indicates how an action gets included in RepeatType::EditSequence.
motion indicates what to do with EditAction::Motion.
Sourcepub fn is_last_action(&self, ctx: &EditContext) -> SequenceStatus
pub fn is_last_action(&self, ctx: &EditContext) -> SequenceStatus
Indicates how an action gets included in RepeatType::LastAction.
Sourcepub fn is_last_selection(&self, ctx: &EditContext) -> SequenceStatus
pub fn is_last_selection(&self, ctx: &EditContext) -> SequenceStatus
Indicates how an action gets included in RepeatType::LastSelection.
Sourcepub fn is_switchable(&self, ctx: &EditContext) -> bool
pub fn is_switchable(&self, ctx: &EditContext) -> bool
Returns true if this Action is allowed to trigger a WindowAction::Switch after an error.