aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorRoland Kovacs2022-05-09 19:12:01 +0000
committerMichael Davis2022-05-21 13:53:16 +0000
commit3f10473d30eec79e135ea74fa2bc4cc996426128 (patch)
tree7b21d83f6a2f3c977e1c740e149d6ec9d930a8ab /helix-term/src/commands.rs
parente8e252648f0287ccd503c59ea2c1fd7a155dafb5 (diff)
Implement view swapping
* add Tree::swap_split_in_direction() * add swap_view_{left,down,up,right} commands, bound to H,J,K,L respectively in the Window menu(s) * add test for view swapping
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index c3c7d224..2839f495 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -360,6 +360,10 @@ impl MappableCommand {
jump_view_left, "Jump to the split to the left",
jump_view_up, "Jump to the split above",
jump_view_down, "Jump to the split below",
+ swap_view_right, "Swap with the split to the right",
+ swap_view_left, "Swap with the split to the left",
+ swap_view_up, "Swap with the split above",
+ swap_view_down, "Swap with the split below",
transpose_view, "Transpose splits",
rotate_view, "Goto next window",
hsplit, "Horizontal bottom split",
@@ -3864,6 +3868,22 @@ fn jump_view_down(cx: &mut Context) {
cx.editor.focus_down()
}
+fn swap_view_right(cx: &mut Context) {
+ cx.editor.swap_right()
+}
+
+fn swap_view_left(cx: &mut Context) {
+ cx.editor.swap_left()
+}
+
+fn swap_view_up(cx: &mut Context) {
+ cx.editor.swap_up()
+}
+
+fn swap_view_down(cx: &mut Context) {
+ cx.editor.swap_down()
+}
+
fn transpose_view(cx: &mut Context) {
cx.editor.transpose_view()
}