From 7dfd7f51a0a8f929c06fa08c524c31176bcde738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 31 Mar 2021 18:00:53 +0900 Subject: [PATCH] Implement space-v as view same file in split. --- helix-term/src/commands.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index d0795d74..844cb429 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1938,6 +1938,17 @@ pub fn jump_backward(cx: &mut Context) { // +pub fn vsplit(cx: &mut Context) { + // TODO: use doc.id directly, this can only split saved files + let path = cx.doc().path().cloned(); + + if let Some(path) = path { + // open the same file again. this will vsplit + cx.editor + .open(path, helix_view::editor::Action::HorizontalSplit); + } +} + pub fn space_mode(cx: &mut Context) { cx.on_next_key(move |cx, event| { if let KeyEvent { @@ -1949,6 +1960,7 @@ pub fn space_mode(cx: &mut Context) { match ch { 'f' => file_picker(cx), 'b' => buffer_picker(cx), + 'v' => vsplit(cx), // ' ' => toggle_alternate_buffer(cx), _ => (), }