From 038e4f9a313a6fa0dcac6814126463747db61971 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Mon, 18 Oct 2021 14:47:05 +0100 Subject: [PATCH] focus editor --- core/src/command.rs | 3 +++ core/src/data.rs | 7 +++++++ defaults/keymaps-macos.toml | 5 +++++ 3 files changed, 15 insertions(+) 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]]