Skip to content

Commit

Permalink
feat: add substitute
Browse files Browse the repository at this point in the history
  • Loading branch information
metiftikci committed Oct 27, 2023
1 parent ffa648e commit 2d468b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/buffer/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn get_default_normal_maps() -> ActionMap {
map.insert("N", buffer_action!(move_to_previous_find));

// operations
map.insert("s", buffer_action!(substitute_char));
map.insert("x", buffer_action!(delete_char));
map.insert("J", buffer_action!(join_lines_cursor));
map.insert("O", buffer_action!(open_new_line_previous));
Expand Down
5 changes: 5 additions & 0 deletions src/buffer/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ impl Buffer {
.unwrap();
}

pub fn substitute_char(&mut self) {
self.delete_char();
self.enter_insert_mode();
}

fn insert_line(&mut self, row: usize) {
self.lines.insert(row, String::new());
self.set_size(self.area.clone());
Expand Down

0 comments on commit 2d468b7

Please sign in to comment.