From 3cf175c81abab0a03c0db65a31296f083de50aa6 Mon Sep 17 00:00:00 2001 From: Kuria <012nkuria@gmail.com> Date: Sat, 23 Jul 2022 13:22:17 +0300 Subject: [PATCH] Add shortcut for evaluating a cell and advancing to the next one (#1294) --- assets/js/hooks/session.js | 7 +++++++ lib/livebook_web/live/session_live/shortcuts_component.ex | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/assets/js/hooks/session.js b/assets/js/hooks/session.js index af33f7f7f..2d1c1c1d8 100644 --- a/assets/js/hooks/session.js +++ b/assets/js/hooks/session.js @@ -295,6 +295,13 @@ const Session = { cancelEvent(event); this.queueFullCellsEvaluation(true); return; + } else if (!cmd && shift && !alt && key === "Enter") { + cancelEvent(event); + if (isEvaluable(this.focusedCellType())) { + this.queueFocusedCellEvaluation(); + } + this.moveFocus(1); + return; } else if (cmd && !alt && key === "Enter") { cancelEvent(event); if (isEvaluable(this.focusedCellType())) { diff --git a/lib/livebook_web/live/session_live/shortcuts_component.ex b/lib/livebook_web/live/session_live/shortcuts_component.ex index 42c38dc44..a7fd3e902 100644 --- a/lib/livebook_web/live/session_live/shortcuts_component.ex +++ b/lib/livebook_web/live/session_live/shortcuts_component.ex @@ -112,6 +112,13 @@ defmodule LivebookWeb.SessionLive.ShortcutsComponent do desc: "Evaluate cell in either mode", basic: true }, + %{ + seq: ["shift", "↵"], + seq_mac: ["⇧", "↵"], + press_all: true, + desc: "Evaluate cell and advance to next one", + basic: true + }, %{ seq: ["ctrl", "shift", "↵"], seq_mac: ["⌘", "⇧", "↵"],