focus editor

This commit is contained in:
Dongdong Zhou 2021-10-18 14:47:05 +01:00
parent 746f4c4aa3
commit 038e4f9a31
3 changed files with 15 additions and 0 deletions

View File

@ -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)]

View File

@ -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),
));
}
}
}

View File

@ -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]]