mod entry;
mod exit;
mod manipulation;
mod operators;
pub use {
entry::{EnterVisualBlockMode, EnterVisualLineMode, EnterVisualMode},
exit::ExitVisualMode,
manipulation::{
ReselectLast, SwapAnchor, ToggleVisualBlock, ToggleVisualChar, ToggleVisualLine,
},
operators::{
ChangeSelection, DedentSelection, DeleteSelection, IndentSelection, LowercaseSelection,
ToggleCaseSelection, UppercaseSelection, YankSelection,
},
};
use reovim_driver_command::CommandHandler;
#[must_use]
pub fn visual_selection_commands() -> Vec<Box<dyn CommandHandler>> {
vec![
Box::new(SwapAnchor),
Box::new(ToggleVisualChar),
Box::new(ToggleVisualLine),
Box::new(ToggleVisualBlock),
Box::new(ReselectLast),
]
}
#[must_use]
pub fn visual_entry_commands() -> Vec<Box<dyn CommandHandler>> {
vec![
Box::new(EnterVisualMode),
Box::new(EnterVisualLineMode),
Box::new(EnterVisualBlockMode),
]
}
#[must_use]
pub fn visual_exit_commands() -> Vec<Box<dyn CommandHandler>> {
vec![Box::new(ExitVisualMode)]
}
#[must_use]
pub fn visual_operator_commands() -> Vec<Box<dyn CommandHandler>> {
vec![
Box::new(DeleteSelection),
Box::new(YankSelection),
Box::new(ChangeSelection),
Box::new(IndentSelection),
Box::new(DedentSelection),
Box::new(ToggleCaseSelection),
Box::new(LowercaseSelection),
Box::new(UppercaseSelection),
]
}
#[must_use]
pub fn visual_commands() -> Vec<Box<dyn CommandHandler>> {
let mut cmds = visual_entry_commands();
cmds.extend(visual_exit_commands());
cmds.extend(visual_selection_commands());
cmds.extend(visual_operator_commands());
cmds
}
#[cfg(test)]
mod tests;