Skip to content

Commit

Permalink
Feat: Add support for deleting a word in normal mode with de, dw,…
Browse files Browse the repository at this point in the history
… `db` (#68)
  • Loading branch information
nickhealthy authored Nov 23, 2024
1 parent 4aff522 commit 4e9a759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/src/state/notebook/inner_state/editing_normal_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,15 @@ async fn consume_delete(

DeleteLines(n).into()
}
Key(KeyEvent::B) => {
state.inner_state = InnerState::EditingNormalMode(VimNormalState::Idle);

DeleteWordBack(n).into()
}
Key(KeyEvent::E) => {
state.inner_state = InnerState::EditingNormalMode(VimNormalState::Idle);
DeleteWordEnd(n).into()
}
Key(KeyEvent::DollarSign) => {
state.inner_state = InnerState::EditingNormalMode(VimNormalState::Idle);

Expand Down
2 changes: 2 additions & 0 deletions tui/src/views/dialog/vim_keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ pub fn draw(frame: &mut Frame, keymap_kind: VimKeymapKind) {
Line::raw(""),
Line::from("DELETE TEXT".white().on_dark_gray()),
Line::raw("[d] Delete the specified number of lines"),
Line::raw("[e] Delete the word from the cursor to the end of the current word."),
Line::raw("[b] Delete the word before the cursor."),
Line::raw("[0] Delete to the beginning of the line"),
Line::raw("[$] Delete to the end of the line, repeated by the specified number"),
]),
Expand Down

0 comments on commit 4e9a759

Please sign in to comment.