vim: ALlow counts on insert actions

This re-uses the existing repeat infrastructure.
This commit is contained in:
Conrad Irwin 2023-09-11 18:01:58 -06:00
parent cee549e1ef
commit d868d00985
8 changed files with 343 additions and 132 deletions

View file

@ -15,8 +15,8 @@ use anyhow::Result;
use collections::{CommandPaletteFilter, HashMap};
use editor::{movement, Editor, EditorMode, Event};
use gpui::{
actions, impl_actions, keymap_matcher::KeymapContext, keymap_matcher::MatchResult, AppContext,
Subscription, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
actions, impl_actions, keymap_matcher::KeymapContext, keymap_matcher::MatchResult, Action,
AppContext, Subscription, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
};
use language::{CursorShape, Point, Selection, SelectionGoal};
pub use mode_indicator::ModeIndicator;
@ -284,6 +284,16 @@ impl Vim {
}
}
pub fn stop_recording_immediately(&mut self, action: Box<dyn Action>) {
if self.workspace_state.recording {
self.workspace_state
.recorded_actions
.push(ReplayableAction::Action(action.boxed_clone()));
self.workspace_state.recording = false;
self.workspace_state.stop_recording_after_next_action = false;
}
}
pub fn record_current_action(&mut self, cx: &mut WindowContext) {
self.start_recording(cx);
self.stop_recording();