From ed60866c5485c8f7e8d2e12fd34dd8243d079b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 16 Dec 2020 16:34:12 +0900 Subject: [PATCH] Add an :o open command. --- helix-term/src/commands.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 462d2a209..cdd2ad346 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -440,8 +440,15 @@ pub fn command_mode(cx: &mut Context) { return; } - match input { - "q" => editor.should_close = true, + let parts = input.split_ascii_whitespace().collect::>(); + + match parts.as_slice() { + &["q"] => editor.should_close = true, + &["o", path] => { + // TODO: make view()/view_mut() always contain a view. + let size = editor.view().unwrap().size; + editor.open(path.into(), size); + } _ => (), } },