Implement space-v as view same file in split.

imgbot
Blaž Hrastnik 3 years ago
parent 6c4093c946
commit 7dfd7f51a0

@ -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) { pub fn space_mode(cx: &mut Context) {
cx.on_next_key(move |cx, event| { cx.on_next_key(move |cx, event| {
if let KeyEvent { if let KeyEvent {
@ -1949,6 +1960,7 @@ pub fn space_mode(cx: &mut Context) {
match ch { match ch {
'f' => file_picker(cx), 'f' => file_picker(cx),
'b' => buffer_picker(cx), 'b' => buffer_picker(cx),
'v' => vsplit(cx),
// ' ' => toggle_alternate_buffer(cx), // ' ' => toggle_alternate_buffer(cx),
_ => (), _ => (),
} }

Loading…
Cancel
Save