diff --git a/client/config.toml b/client/config.toml index e8fe1f6..f49d354 100644 --- a/client/config.toml +++ b/client/config.toml @@ -1,7 +1,7 @@ # config.toml [keybindings] -# [keybindings.global] +enter_command_mode = [":", "ctrl+;"] [keybindings.intro] next_option = ["j", "Right"] @@ -40,7 +40,6 @@ move_line_start = ["0"] move_line_end = ["$"] move_first_line = ["gg"] move_last_line = ["x"] -enter_command_mode = [":", "ctrl+;"] [keybindings.edit] exit_edit_mode = ["esc","ctrl+e"] diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 6fc020f..2e5bd89 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -81,6 +81,24 @@ impl EventHandler { ))); } + // Global command mode activation + let context_action = config.get_action_for_current_context( + self.is_edit_mode, + self.command_mode, + app_state.ui.show_intro, + app_state.ui.show_admin, + key_code, + modifiers + ); + + if let Some("enter_command_mode") = context_action { + if self.is_edit_mode { return Ok((false, String::new())); } + self.command_mode = true; + self.command_input.clear(); + self.command_message.clear(); + return Ok((false, String::new())); + } + if let Some(action) = config.get_action_for_key_in_mode( &config.keybindings.common, key_code,