Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/hot-keys/default-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { BindingsMap } from "./types";

const defaultBindings: BindingsMap = {
// project
add_file: isMac ? "command+alt+u" : "ctrl+alt+u",
new_document: isMac ? "command+alt+n" : "ctrl+alt+n",
add_file: isMac ? "ctrl+command+u" : "ctrl+alt+u",
new_document: isMac ? "ctrl+command+n" : "ctrl+alt+n",
open_target_config_dialog: isMac ? "command+alt+t" : "ctrl+alt+t",
pause_playback: isMac ? "command+p" : "ctrl+p",
run_project: isMac ? "command+r" : "ctrl+r",
Expand Down
1 change: 1 addition & 0 deletions src/components/hot-keys/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { replace, pipe, when } from "ramda";

export const humanizeKeySequence = (keySequence: string): string =>
pipe(
when(() => isMac, replace("ctrl", "⌃")),
when(() => isMac, replace("command", "⌘")),
when(() => isMac, replace("opt", "⌥"))
)(keySequence);
95 changes: 55 additions & 40 deletions src/components/site-documents/keyboard-shortcuts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
import React from "react";
import { isMac } from "@root/utils";

type ShortcutRow = {
shortcut: string;
action: string;
};

const shortcutRows: ShortcutRow[] = [
{
shortcut: isMac ? "ctrl-command-n" : "ctrl-alt-n",
action: "New file"
},
{
shortcut: isMac ? "ctrl-command-u" : "ctrl-alt-u",
action: "Add file(s)"
},
{
shortcut: isMac ? "command-e" : "ctrl-e",
action: "Evaluate current line"
},
{
shortcut: isMac ? "command-enter" : "ctrl-enter",
action: "Evaluate current block"
},
{
shortcut: isMac ? "ctrl-." : "alt-.",
action: "Show opcode documentation for opcode at cursor"
},
{
shortcut: isMac ? "command-; / opt-command-;" : "ctrl-; / ctrl-shift-;",
action: "Toggle comment"
},
{
shortcut: isMac ? "command-s" : "ctrl-s",
action: "Save current document"
},
{
shortcut: isMac ? "opt-command-s" : "ctrl-shift-s",
action: "Save all documents"
},
{
shortcut: isMac ? "command-r" : "ctrl-r",
action: "Run/Restart realtime rendering"
},
{
shortcut: isMac ? "command-p" : "ctrl-p",
action: "Pause realtime rendering"
}
];

export const KeyboardShortcuts = () => (
<div>
Expand All @@ -11,46 +60,12 @@ export const KeyboardShortcuts = () => (
</tr>
</thead>
<tbody>
<tr>
<td>ctrl-e</td>
<td>Evaluate current line</td>
</tr>
<tr>
<td>ctrl-enter</td>
<td>Evaluate current block</td>
</tr>
<tr>
<td>ctrl-.</td>
<td>Show opcode documentation for opcode at cursor</td>
</tr>
<tr>
<td>ctrl-;</td>
<td>Toggle comment</td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td>ctrl-s</td>
<td>Save current document</td>
</tr>
<tr>
<td>shift-ctrl-s</td>
<td>Save all documents</td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td>ctrl-r</td>
<td>Run/Restart realtime rendering</td>
</tr>
<tr>
<td>ctrl-p</td>
<td>Pause realtime rendering</td>
</tr>
{shortcutRows.map(({ shortcut, action }) => (
<tr key={action}>
<td>{shortcut}</td>
<td>{action}</td>
</tr>
))}
</tbody>
</table>
</div>
Expand Down
Loading