Skip to content

Commit

Permalink
vim: Add r command
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed May 13, 2021
1 parent 4e5a212 commit c537487
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts_examples/script3/irust_vim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ fn main() {
match *state {
State::f => return Some(Command::MoveForwardTillChar(c)),
State::F => return Some(Command::MoveBackwardTillChar(c)),
State::r => {
return Some(Command::Multiple(vec![
Command::HandleDelete,
Command::HandleCharacter(c),
Command::HandleLeft,
]))
}
State::ci => {
*mode = Mode::Insert;
return Some(Command::Multiple(vec![
Expand Down Expand Up @@ -180,6 +187,12 @@ fn main() {
Some(Command::GoToLastRow)
}
}
'r' => {
if *state == State::Empty {
*state = State::r;
}
Some(Command::Continue)
}
'x' => Some(Command::Multiple(vec![
Command::HandleDelete,
Command::PrintInput,
Expand Down Expand Up @@ -320,6 +333,7 @@ enum State {
g,
f,
F,
r,
}

#[derive(PartialEq)]
Expand Down

0 comments on commit c537487

Please sign in to comment.