diff --git a/src/components/hot-keys/default-bindings.ts b/src/components/hot-keys/default-bindings.ts index 99425b1c..0d7cd41e 100644 --- a/src/components/hot-keys/default-bindings.ts +++ b/src/components/hot-keys/default-bindings.ts @@ -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", diff --git a/src/components/hot-keys/utils.ts b/src/components/hot-keys/utils.ts index c3c58bd1..15546baa 100644 --- a/src/components/hot-keys/utils.ts +++ b/src/components/hot-keys/utils.ts @@ -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); diff --git a/src/components/site-documents/keyboard-shortcuts.tsx b/src/components/site-documents/keyboard-shortcuts.tsx index 9ca7a17d..8cecba9a 100644 --- a/src/components/site-documents/keyboard-shortcuts.tsx +++ b/src/components/site-documents/keyboard-shortcuts.tsx @@ -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 = () => (