feat(keymap): expose registry and update keybinding
Expose CmdRegistry via KeymapSet registry method. Update Z keybinding to use SaveAndQuit command. Pass registry to App's CmdContext construction. Co-Authored-By: fiddlerwoaroof/git-smart-commit (bartowski/nvidia_Nemotron-Cascade-2-30B-A3B-GGUF)
This commit is contained in:
@ -222,6 +222,10 @@ impl KeymapSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn registry(&self) -> &CmdRegistry {
|
||||||
|
&self.registry
|
||||||
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, mode: ModeKey, keymap: Arc<Keymap>) {
|
pub fn insert(&mut self, mode: ModeKey, keymap: Arc<Keymap>) {
|
||||||
self.mode_maps.insert(mode, keymap);
|
self.mode_maps.insert(mode, keymap);
|
||||||
}
|
}
|
||||||
@ -409,11 +413,7 @@ impl KeymapSet {
|
|||||||
normal.bind_prefix(KeyCode::Char('y'), none, Arc::new(y_map));
|
normal.bind_prefix(KeyCode::Char('y'), none, Arc::new(y_map));
|
||||||
|
|
||||||
let mut z_map = Keymap::new();
|
let mut z_map = Keymap::new();
|
||||||
z_map.bind_seq(
|
z_map.bind(KeyCode::Char('Z'), none, "wq");
|
||||||
KeyCode::Char('Z'),
|
|
||||||
none,
|
|
||||||
vec![("save", vec![]), ("force-quit", vec![])],
|
|
||||||
);
|
|
||||||
normal.bind_prefix(KeyCode::Char('Z'), none, Arc::new(z_map));
|
normal.bind_prefix(KeyCode::Char('Z'), none, Arc::new(z_map));
|
||||||
|
|
||||||
set.insert(ModeKey::Normal, Arc::new(normal));
|
set.insert(ModeKey::Normal, Arc::new(normal));
|
||||||
|
|||||||
@ -160,6 +160,7 @@ impl App {
|
|||||||
CmdContext {
|
CmdContext {
|
||||||
model: &self.model,
|
model: &self.model,
|
||||||
layout,
|
layout,
|
||||||
|
registry: self.keymap_set.registry(),
|
||||||
mode: &self.mode,
|
mode: &self.mode,
|
||||||
selected: view.selected,
|
selected: view.selected,
|
||||||
row_offset: view.row_offset,
|
row_offset: view.row_offset,
|
||||||
|
|||||||
Reference in New Issue
Block a user