on master help sign in
Add an :o open command.
commited60866c5485c8f7e8d2e12fd34dd8243d079b2a authorBlaž Hrastnik <blaz@mxxn.io> dateWed 16 Dec 2020, 16:34 (6 years ago) parent8f0b28a
1 file changed+9−2
helix-term/src/commands.rs+9−2
helix-term/src/commands.rs+9−2
@@ -440,8 +440,15 @@ pub fn command_mode(cx: &mut Context) {
440440 return;
441441 }
442442
443− match input {
444− "q" => editor.should_close = true,
443+ let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
444+
445+ match parts.as_slice() {
446+ &["q"] => editor.should_close = true,
447+ &["o", path] => {
448+ // TODO: make view()/view_mut() always contain a view.
449+ let size = editor.view().unwrap().size;
450+ editor.open(path.into(), size);
451+ }
445452 _ => (),
446453 }
447454 },