diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-10-15 17:27:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-15 17:27:44 +0200 |
| commit | 0c9d72c51e451d4b0ff91e0fa1495187c59a48be (patch) | |
| tree | 56d307d0f6a32caab7f664bc4a6b049de48137fd /default-plugins | |
| parent | docs(changelog): reload config flag fix (diff) | |
| download | sl0ppij-0c9d72c51e451d4b0ff91e0fa1495187c59a48be.tar.gz sl0ppij-0c9d72c51e451d4b0ff91e0fa1495187c59a48be.tar.xz sl0ppij-0c9d72c51e451d4b0ff91e0fa1495187c59a48be.zip | |
feat(plugins): rebind keys api (#3680)
* feat(plugins): add API to explicitly unbind/rebind specific keys in specific modes
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins')
| -rw-r--r-- | default-plugins/fixture-plugin-for-tests/src/main.rs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/default-plugins/fixture-plugin-for-tests/src/main.rs b/default-plugins/fixture-plugin-for-tests/src/main.rs index 35f8d574..6aca8718 100644 --- a/default-plugins/fixture-plugin-for-tests/src/main.rs +++ b/default-plugins/fixture-plugin-for-tests/src/main.rs @@ -445,6 +445,86 @@ impl ZellijPlugin for State { skip_plugin_cache, ) }, + BareKey::Char('y') if key.has_modifiers(&[KeyModifier::Alt]) => { + let write_to_disk = true; + let mut keys_to_unbind = vec![ + ( + InputMode::Locked, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Normal, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Pane, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Tab, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Resize, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Move, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Search, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ( + InputMode::Session, + KeyWithModifier::new(BareKey::Char('g')).with_ctrl_modifier(), + ), + ]; + let mut keys_to_rebind = vec![ + ( + InputMode::Locked, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Normal)], + ), + ( + InputMode::Normal, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Pane, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Tab, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Resize, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Move, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Search, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ( + InputMode::Session, + KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier(), + vec![actions::Action::SwitchToMode(InputMode::Locked)], + ), + ]; + rebind_keys(keys_to_unbind, keys_to_rebind, write_to_disk); + }, _ => {}, }, Event::CustomMessage(message, payload) => { |
