vim cl (#11641)
Release Notes: - vim: Added support for the changelist. `g;` and `g,` to the previous/next change - vim: Added support for the `'.` mark - vim: Added support for `gi` to resume the previous insert
This commit is contained in:
parent
4f9ba28a25
commit
45f12b9426
10 changed files with 326 additions and 10 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
mod change_list;
|
||||
mod command;
|
||||
mod editor_events;
|
||||
mod insert;
|
||||
|
|
@ -17,6 +18,7 @@ mod utils;
|
|||
mod visual;
|
||||
|
||||
use anyhow::Result;
|
||||
use change_list::push_to_change_list;
|
||||
use collections::HashMap;
|
||||
use command_palette_hooks::{CommandPaletteFilter, CommandPaletteInterceptor};
|
||||
use editor::{
|
||||
|
|
@ -159,6 +161,7 @@ fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
|||
replace::register(workspace, cx);
|
||||
object::register(workspace, cx);
|
||||
visual::register(workspace, cx);
|
||||
change_list::register(workspace, cx);
|
||||
}
|
||||
|
||||
/// Called whenever an keystroke is typed so vim can observe all actions
|
||||
|
|
@ -264,6 +267,7 @@ impl Vim {
|
|||
EditorEvent::TransactionUndone { transaction_id } => Vim::update(cx, |vim, cx| {
|
||||
vim.transaction_undone(transaction_id, cx);
|
||||
}),
|
||||
EditorEvent::Edited => Vim::update(cx, |vim, cx| vim.transaction_ended(editor, cx)),
|
||||
_ => {}
|
||||
}));
|
||||
|
||||
|
|
@ -618,6 +622,10 @@ impl Vim {
|
|||
self.switch_mode(Mode::Normal, true, cx)
|
||||
}
|
||||
|
||||
fn transaction_ended(&mut self, editor: View<Editor>, cx: &mut WindowContext) {
|
||||
push_to_change_list(self, editor, cx)
|
||||
}
|
||||
|
||||
fn local_selections_changed(&mut self, editor: View<Editor>, cx: &mut WindowContext) {
|
||||
let newest = editor.read(cx).selections.newest_anchor().clone();
|
||||
let is_multicursor = editor.read(cx).selections.count() > 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue