diff --git a/core/src/command.rs b/core/src/command.rs index f54d27c4..7d198970 100644 --- a/core/src/command.rs +++ b/core/src/command.rs @@ -141,6 +141,9 @@ pub enum LapceWorkbenchCommand { #[strum(serialize = "toggle_maximized_panel")] ToggleMaximizedPanel, + + #[strum(serialize = "focus_editor")] + FocusEditor, } #[derive(Display, EnumString, EnumIter, Clone, PartialEq, Debug, EnumMessage)] diff --git a/core/src/data.rs b/core/src/data.rs index d7daba55..06cd746d 100644 --- a/core/src/data.rs +++ b/core/src/data.rs @@ -787,6 +787,13 @@ pub fn run_workbench_command( let panel = Arc::make_mut(panel); panel.maximized = !panel.maximized; } + LapceWorkbenchCommand::FocusEditor => { + ctx.submit_command(Command::new( + LAPCE_UI_COMMAND, + LapceUICommand::Focus, + Target::Widget(*self.main_split.active), + )); + } } } diff --git a/defaults/keymaps-macos.toml b/defaults/keymaps-macos.toml index 3068182b..c79e0a90 100644 --- a/defaults/keymaps-macos.toml +++ b/defaults/keymaps-macos.toml @@ -51,6 +51,11 @@ key = "ctrl+." command = "show_code_actions" mode = "n" +[[keymaps]] +key = "meta+k" +command = "focus_editor" +when = "panel_focus" + # --------------------------------- Basic editing --------------------------------------- [[keymaps]]