diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index aecd0f90b2..52f922cd06 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -439,9 +439,7 @@ impl Vim { )) } - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.set_clip_at_line_ends(true, cx); editor.change_selections(None, cx, |s| { s.move_with(|map, selection| { diff --git a/crates/vim/src/normal/case.rs b/crates/vim/src/normal/case.rs index 609b417b1a..2c591a1f1f 100644 --- a/crates/vim/src/normal/case.rs +++ b/crates/vim/src/normal/case.rs @@ -163,15 +163,12 @@ impl Vim { editor.transact(cx, |editor, cx| { for range in ranges.into_iter().rev() { let snapshot = editor.buffer().read(cx).snapshot(cx); - editor.buffer().update(cx, |buffer, cx| { - let text = snapshot - .text_for_range(range.start..range.end) - .flat_map(|s| s.chars()) - .flat_map(transform) - .collect::(); - - buffer.edit([(range, text)], None, cx) - }) + let text = snapshot + .text_for_range(range.start..range.end) + .flat_map(|s| s.chars()) + .flat_map(transform) + .collect::(); + editor.edit([(range, text)], cx) } editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.select_ranges(cursor_positions) diff --git a/crates/vim/src/replace.rs b/crates/vim/src/replace.rs index 6d4e5eeb67..201faa6443 100644 --- a/crates/vim/src/replace.rs +++ b/crates/vim/src/replace.rs @@ -5,7 +5,7 @@ use crate::{ }; use editor::{display_map::ToDisplayPoint, Bias, Editor, ToPoint}; use gpui::{actions, ViewContext}; -use language::{AutoindentMode, Point}; +use language::Point; use std::ops::Range; use std::sync::Arc; @@ -58,15 +58,7 @@ impl Vim { }) .collect::>(); - editor.buffer().update(cx, |buffer, cx| { - buffer.edit( - edits.clone(), - Some(AutoindentMode::Block { - original_indent_columns: Vec::new(), - }), - cx, - ); - }); + editor.edit_with_block_indent(edits.clone(), Vec::new(), cx); editor.change_selections(None, cx, |s| { s.select_anchor_ranges(edits.iter().map(|(range, _)| range.end..range.end)); @@ -113,9 +105,7 @@ impl Vim { }) .collect::>(); - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.change_selections(None, cx, |s| { s.select_ranges(new_selections); diff --git a/crates/vim/src/surrounds.rs b/crates/vim/src/surrounds.rs index 781485e4cc..88bcb6a2e1 100644 --- a/crates/vim/src/surrounds.rs +++ b/crates/vim/src/surrounds.rs @@ -119,9 +119,7 @@ impl Vim { } } - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.set_clip_at_line_ends(true, cx); editor.change_selections(Some(Autoscroll::fit()), cx, |s| { if mode == Mode::VisualBlock { @@ -220,9 +218,7 @@ impl Vim { s.select_ranges(anchors); }); edits.sort_by_key(|(range, _)| range.start); - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.set_clip_at_line_ends(true, cx); }); }); @@ -320,9 +316,7 @@ impl Vim { }) .collect::>(); edits.sort_by_key(|(range, _)| range.start); - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.set_clip_at_line_ends(true, cx); editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.select_anchor_ranges(stable_anchors); diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index 08c80aef2e..47aa618b5c 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -530,9 +530,7 @@ impl Vim { } } - editor.buffer().update(cx, |buffer, cx| { - buffer.edit(edits, None, cx); - }); + editor.edit(edits, cx); editor.change_selections(None, cx, |s| s.select_ranges(stable_anchors)); }); });