CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/account/keyboard-shortcuts.ts
Views: 687
1
import { defineMessage } from "react-intl";
2
3
import { IntlMessage } from "@cocalc/frontend/i18n";
4
5
export default function keyboardShortcuts(
6
isMacOS: boolean,
7
): Readonly<{ command: IntlMessage; shortcut: string }[]> {
8
return [
9
//'Next file tab' : 'control+]' # temporarily disabled since broken in many ways
10
//'Previous file tab' : 'control+['
11
{
12
command: defineMessage({
13
id: "account.keyboard-shortcuts.shortcut.run-code",
14
defaultMessage: "Build project / run code",
15
}),
16
shortcut: isMacOS ? "shift+enter; option+T" : "shift+enter; alt+T",
17
},
18
{
19
command: defineMessage({
20
id: "account.keyboard-shortcuts.shortcut.force-build",
21
defaultMessage: "Force build project",
22
}),
23
shortcut: isMacOS
24
? "shift+option+enter; shift+option+T"
25
: "shift+alt+enter; shift+alt+T",
26
},
27
{
28
command: defineMessage({
29
id: "account.keyboard-shortcuts.shortcut.forward-inverse-search",
30
defaultMessage: "LaTeX and markdown forward and inverse search",
31
}),
32
shortcut: isMacOS ? "⌘+enter" : "alt+enter",
33
},
34
{
35
command: defineMessage({
36
id: "account.keyboard-shortcuts.shortcut.make-text-smaller",
37
defaultMessage: "Make text smaller",
38
}),
39
shortcut: "control+<",
40
},
41
{
42
command: defineMessage({
43
id: "account.keyboard-shortcuts.shortcut.make-text-larger",
44
45
defaultMessage: "Make text larger",
46
}),
47
shortcut: "control+>",
48
},
49
{
50
command: defineMessage({
51
id: "account.keyboard-shortcuts.shortcut.toggle-comment",
52
defaultMessage: "Toggle commenting selection",
53
}),
54
shortcut: "control+/",
55
},
56
{
57
command: defineMessage({
58
id: "account.keyboard-shortcuts.shortcut.goto",
59
defaultMessage: "Go to line",
60
}),
61
shortcut: isMacOS ? "⌘+L" : "control+L",
62
},
63
{
64
command: defineMessage({
65
id: "account.keyboard-shortcuts.shortcut.find",
66
defaultMessage: "Find",
67
}),
68
shortcut: isMacOS ? "⌘+F" : "control+F",
69
},
70
{
71
command: defineMessage({
72
id: "account.keyboard-shortcuts.shortcut.find-next",
73
defaultMessage: "Find next",
74
}),
75
shortcut: isMacOS ? "⌘+G" : "control+G",
76
},
77
{
78
command: defineMessage({
79
id: "account.keyboard-shortcuts.shortcut.replace",
80
defaultMessage: "Replace",
81
}),
82
shortcut: isMacOS ? "⌘+H" : "control+H",
83
},
84
{
85
command: defineMessage({
86
id: "account.keyboard-shortcuts.shortcut.fold-unfold",
87
defaultMessage: "Fold/unfold selected code",
88
}),
89
shortcut: "control+Q",
90
},
91
{
92
command: defineMessage({
93
id: "account.keyboard-shortcuts.shortcut.fill-paragraph",
94
defaultMessage: "Fill paragraph (like in Emacs)",
95
}),
96
shortcut: isMacOS ? "option+Q" : "alt+Q",
97
},
98
{
99
command: defineMessage({
100
id: "account.keyboard-shortcuts.shortcut.shift-text-right",
101
defaultMessage: "Shift selected text right",
102
}),
103
shortcut: "tab",
104
},
105
{
106
command: defineMessage({
107
id: "account.keyboard-shortcuts.shortcut.shift-text-left",
108
defaultMessage: "Shift selected text left",
109
}),
110
shortcut: "shift+tab",
111
},
112
{
113
command: defineMessage({
114
id: "account.keyboard-shortcuts.shortcut.split-view-sagews",
115
defaultMessage: "Split view in Sage worksheet",
116
}),
117
shortcut: "shift+control+I",
118
},
119
{
120
command: defineMessage({
121
id: "account.keyboard-shortcuts.shortcut.autoindent",
122
defaultMessage: "Autoindent selection",
123
}),
124
shortcut: "control+'",
125
},
126
{
127
command: defineMessage({
128
id: "account.keyboard-shortcuts.shortcut.format-code",
129
defaultMessage: "Format code (use Prettier, etc)",
130
}),
131
shortcut: isMacOS ? "⌘+shift+F" : "control+shift+F",
132
},
133
{
134
command: defineMessage({
135
id: "account.keyboard-shortcuts.shortcut.multiple-cursors",
136
defaultMessage: "Create multiple cursors",
137
}),
138
shortcut: isMacOS ? "⌘+click" : "control+click",
139
},
140
{
141
command: defineMessage({
142
id: "account.keyboard-shortcuts.shortcut.latex-autocomplete",
143
defaultMessage: "LaTeX (etc) simple autocomplete",
144
}),
145
shortcut: isMacOS ? "option+space" : "control+space",
146
},
147
{
148
command: defineMessage({
149
id: "account.keyboard-shortcuts.shortcut.sage-autocomplete",
150
defaultMessage: "Sage autocomplete",
151
}),
152
shortcut: "tab",
153
},
154
{
155
command: defineMessage({
156
id: "account.keyboard-shortcuts.shortcut.split-cell",
157
defaultMessage: "Split cell in Sage worksheet",
158
}),
159
shortcut: "control+;",
160
},
161
] as const;
162
}
163
164