aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-16 07:34:12 +0000
committerBlaž Hrastnik2020-12-16 07:34:12 +0000
commited60866c5485c8f7e8d2e12fd34dd8243d079b2a (patch)
treee4e6fe71f26ab463c1735dc7922074c7ee1f9a10 /helix-term/src
parent8f0b28aeb872797e4be3f07575e628f5f93e74e0 (diff)
Add an :o open command.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 462d2a20..cdd2ad34 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::<Vec<&str>>();
+
+ 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);
+ }
_ => (),
}
},