on master help sign in
Add command to rotate view backward (#5356)
commite7e47fd54263fb46f2dbb6fe8954fa489d143752 authormejo13 <36098293+mejo13@users.noreply.github.com> dateTue 17 Jan 2023, 23:15 (4 years ago) parent9530fab
2 files changed+9
helix-term/src/commands.rs+5 helix-view/src/editor.rs+4
helix-term/src/commands.rs+5
@@ -384,6 +384,7 @@ impl MappableCommand {
384384 swap_view_down, "Swap with split below",
385385 transpose_view, "Transpose splits",
386386 rotate_view, "Goto next window",
387+ rotate_view_reverse, "Goto previous window",
387388 hsplit, "Horizontal bottom split",
388389 hsplit_new, "Horizontal bottom split scratch buffer",
389390 vsplit, "Vertical right split",
@@ -4317,6 +4318,10 @@ fn rotate_view(cx: &mut Context) {
43174318 cx.editor.focus_next()
43184319}
43194320
4321+fn rotate_view_reverse(cx: &mut Context) {
4322+ cx.editor.focus_prev()
4323+}
4324+
43204325fn jump_view_right(cx: &mut Context) {
43214326 cx.editor.focus_direction(tree::Direction::Right)
43224327}
helix-view/src/editor.rs+4
@@ -1285,6 +1285,10 @@ impl Editor {
12851285 self.focus(self.tree.next());
12861286 }
12871287
1288+ pub fn focus_prev(&mut self) {
1289+ self.focus(self.tree.prev());
1290+ }
1291+
12881292 pub fn focus_direction(&mut self, direction: tree::Direction) {
12891293 let current_view = self.tree.focus;
12901294 if let Some(id) = self.tree.find_split_in_direction(current_view, direction) {