Skip to content

Commit

Permalink
Added 2 keybindings to vim('X' and 'S'). Changed the --workspace key …
Browse files Browse the repository at this point in the history
…to --all in cargo fmt, cause --workspace is not exists in fmt (#122)
  • Loading branch information
Distantoff authored Oct 21, 2024
1 parent a454532 commit 85b54d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ to start a discussion before making too much progress.
make sure to check the format before opening a PR by running:

```sh
cargo fmt --workspace --check
cargo fmt --all --check
```

### Tests
Expand Down
21 changes: 21 additions & 0 deletions src/vim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ impl Vim {
self.send_copy_action_with_text(textarea.yank_text());
return Transition::Mode(Mode::Normal);
},
Input { key: Key::Char('X'), .. } => {
if self.mode == Mode::Visual {
textarea.move_cursor(CursorMove::Head);
textarea.start_selection();
textarea.move_cursor(CursorMove::End);
} else {
textarea.start_selection();
textarea.move_cursor(CursorMove::Back);
}
textarea.cut();
self.send_copy_action_with_text(textarea.yank_text());
return Transition::Mode(Mode::Normal);
},
Input { key: Key::Char('i'), .. } => {
textarea.cancel_selection();
return Transition::Mode(Mode::Insert);
Expand Down Expand Up @@ -314,6 +327,14 @@ impl Vim {
self.send_copy_action_with_text(textarea.yank_text());
return Transition::Mode(Mode::Insert);
},
Input { key: Key::Char('S'), ctrl: false, .. } => {
textarea.move_cursor(CursorMove::Head);
textarea.start_selection();
textarea.move_cursor(CursorMove::End);
textarea.cut();
self.send_copy_action_with_text(textarea.yank_text());
return Transition::Mode(Mode::Insert);
},
Input { key: Key::Esc, .. } => {
textarea.cancel_selection();
return Transition::Mode(Mode::Normal);
Expand Down

0 comments on commit 85b54d5

Please sign in to comment.