aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-31 09:00:53 +0000
committerBlaž Hrastnik2021-03-31 09:00:53 +0000
commit7dfd7f51a0a8f929c06fa08c524c31176bcde738 (patch)
treebaff7b0091911c347205c927fc92173053664fb3 /helix-term
parent6c4093c94634a94adbccb4783cddb90076881c02 (diff)
Implement space-v as view same file in split.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 12 insertions, 0 deletions
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),
_ => (),
}