on master help sign in
Implement space-v as view same file in split.
commit7dfd7f51a0a8f929c06fa08c524c31176bcde738 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 31 Mar 2021, 18:00 (6 years ago) parent6c4093c
1 file changed+12
helix-term/src/commands.rs+12
helix-term/src/commands.rs+12
@@ -1938,6 +1938,17 @@ pub fn jump_backward(cx: &mut Context) {
19381938
19391939//
19401940
1941+pub fn vsplit(cx: &mut Context) {
1942+ // TODO: use doc.id directly, this can only split saved files
1943+ let path = cx.doc().path().cloned();
1944+
1945+ if let Some(path) = path {
1946+ // open the same file again. this will vsplit
1947+ cx.editor
1948+ .open(path, helix_view::editor::Action::HorizontalSplit);
1949+ }
1950+}
1951+
19411952pub fn space_mode(cx: &mut Context) {
19421953 cx.on_next_key(move |cx, event| {
19431954 if let KeyEvent {
@@ -1949,6 +1960,7 @@ pub fn space_mode(cx: &mut Context) {
19491960 match ch {
19501961 'f' => file_picker(cx),
19511962 'b' => buffer_picker(cx),
1963+ 'v' => vsplit(cx),
19521964 // ' ' => toggle_alternate_buffer(cx),
19531965 _ => (),
19541966 }