on master help sign in
Implement space-v as view same file in split.
7dfd7f5Blaž Hrastnik
helix-term/src/commands.rs+12
@@ -1938,6 +1938,17 @@ pub fn jump_backward(cx: &mut Context) {
1938
1938
1939//
1939//
1940
1940
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+
1941pub fn space_mode(cx: &mut Context) {
1952pub fn space_mode(cx: &mut Context) {
1942 cx.on_next_key(move |cx, event| {
1953 cx.on_next_key(move |cx, event| {
1943 if let KeyEvent {
1954 if let KeyEvent {
@@ -1949,6 +1960,7 @@ pub fn space_mode(cx: &mut Context) {
1949 match ch {
1960 match ch {
1950 'f' => file_picker(cx),
1961 'f' => file_picker(cx),
1951 'b' => buffer_picker(cx),
1962 'b' => buffer_picker(cx),
1963+ 'v' => vsplit(cx),
1952 // ' ' => toggle_alternate_buffer(cx),
1964 // ' ' => toggle_alternate_buffer(cx),
1953 _ => (),
1965 _ => (),
1954 }
1966 }