vim: Add :norm support (#33232)

Closes #21198

Release Notes:

- Adds support for `:norm`
- Allows for vim and zed style modified keys specified in issue
  - Vim style <C-w> and zed style <ctrl-w>
- Differs from vim in how multi-line is handled 
  - vim is sequential
  - zed is combinational (with multi-cursor)
This commit is contained in:
AidanV 2025-07-23 22:06:05 -07:00 committed by GitHub
parent c08851a85e
commit 8b0ec287a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 328 additions and 48 deletions

View file

@ -16968,7 +16968,7 @@ impl Editor {
now: Instant,
window: &mut Window,
cx: &mut Context<Self>,
) {
) -> Option<TransactionId> {
self.end_selection(window, cx);
if let Some(tx_id) = self
.buffer
@ -16978,7 +16978,10 @@ impl Editor {
.insert_transaction(tx_id, self.selections.disjoint_anchors());
cx.emit(EditorEvent::TransactionBegun {
transaction_id: tx_id,
})
});
Some(tx_id)
} else {
None
}
}
@ -17006,6 +17009,17 @@ impl Editor {
}
}
pub fn modify_transaction_selection_history(
&mut self,
transaction_id: TransactionId,
modify: impl FnOnce(&mut (Arc<[Selection<Anchor>]>, Option<Arc<[Selection<Anchor>]>>)),
) -> bool {
self.selection_history
.transaction_mut(transaction_id)
.map(modify)
.is_some()
}
pub fn set_mark(&mut self, _: &actions::SetMark, window: &mut Window, cx: &mut Context<Self>) {
if self.selection_mark_mode {
self.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {