Skip to content

Commit e50fc17

Browse files
Align keybindings doc with DrR UI (#711)
Change the keybindings page to use the same (platform independent) notation as is present in the 'Show Active Keybindings' keybindings window.
1 parent db93ecd commit e50fc17

File tree

1 file changed

+120
-84
lines changed

1 file changed

+120
-84
lines changed

drracket/scribblings/drracket/keybindings.scrbl

Lines changed: 120 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,70 @@ that move the blinking caret, delete a line, copy the selection,
2525
etc. Keyboard shortcuts are usually trigger by key combinations using
2626
the Control, Meta, or Command key.
2727

28+
The keyboard shortcuts are displayed using the same string-encoded notation
29+
for modifier keys as @xmethod[keymap% map-function] and the Keybindings view;
30+
31+
@itemize[
32+
33+
@item{@litchar{s:} --- All platforms: Shift}
34+
35+
@item{@litchar{c:} --- All platforms: Control}
36+
37+
@item{@litchar{a:} --- Mac OS: Option}
38+
39+
@item{@litchar{m:} --- Windows: Alt; Unix: Meta; Mac OS: Command, when
40+
@racket[map-command-as-meta-key] produces @racket[#t]}
41+
42+
@item{@litchar{d:} --- Mac OS: Command}
43+
44+
@item{@litchar{l:} --- All platforms: Caps Lock}
45+
46+
@item{@litchar{g:} --- Windows: Control plus Alt as AltGr;
47+
see @xmethod[key-event% get-control+meta-is-altgr]}
48+
49+
@item{@litchar{?:} --- All platforms: allow match to character produced by opposite
50+
use of Shift, AltGr/Option, and/or Caps Lock, when available; see
51+
@xmethod[key-event% get-other-shift-key-code]}
52+
]
53+
54+
If a modifier key is not specified, it matches whether that modifier is
55+
pressed or not pressed. A @litchar{~} prior to a modifier indicates the
56+
keybinding only activates if that modifier is not pressed.
57+
58+
A keyboard shortcut that begins with @litchar{:} only activates if the modifiers
59+
Shift, Control, Option, Alt, Meta, or Command are not pressed.
60+
2861
@margin-note{Many of the key-binding actions can also be performed
2962
with menu items.}
3063

31-
C-@nonterm{key} means press the Control key, hold it down and then
32-
press @nonterm{key} and then release them both. For example: C-e
64+
c:@nonterm{key} means press the Control key, hold it down and then
65+
press @nonterm{key} and then release them both. For example: c:e
3366
(Control-E) moves the blinking caret to the end of the current line.
3467

35-
M-@nonterm{key} is the same as C-@nonterm{key}, except with the Meta
68+
m:@nonterm{key} is the same as c:@nonterm{key}, except with the Meta
3669
key. Depending on your keyboard, Meta may be called ``Left,''
3770
``Right,'' or have a diamond symbol, but it's usually on the bottom
38-
row next to the space bar. M-@nonterm{key} can also be performed as a
71+
row next to the space bar. m:@nonterm{key} can also be performed as a
3972
two-character sequence: first, strike and release the Escape key, then
4073
strike @nonterm{key}. On Mac OS, Meta is, by default,
4174
available only through the Escape key. But the preferences dialog
4275
(in the @onscreen{General Editing} sub-panel of the @onscreen{Editing} panel)
4376
has check boxes that adjust the handling of the Alt key or the Command
4477
key to be meta.
4578

46-
DEL is the Delete key.
79+
@litchar{delete} is the Delete key.
4780

48-
SPACE is the Space bar.
81+
@litchar{space} is the Space bar.
4982

5083
On most keyboards, ``<'' and ``>'' are shifted characters. So, to
51-
get M->, you actually have to type Meta-Shift->. That is, press and
84+
get m:>, you actually have to type Meta-Shift->. That is, press and
5285
hold down both the Meta and Shift keys, and then strike ``>''.
5386

5487
On Windows (and sometimes under Unix)
5588
some of these keybindings are actually standard menu
5689
items. Those keybindings will behave according to the menus, unless
5790
the @onscreen{Enable keybindings in menus} preference is unchecked.
58-
For example, the C-e keybinding mentioned above actually toggles
91+
For example, the c:e keybinding mentioned above actually toggles
5992
the visibility of the interactions window.
6093

6194
@index['("Emacs keybindings")]{If} you are most familiar with
@@ -66,6 +99,9 @@ keybindings in menus} preference. Many of the keybindings below are
6699
inspired by Emacs. See also @secref["defining-shortcuts"] for suggestions
67100
on how to bind keys to menu items on a selective basis.
68101

102+
@margin-note{Some keybindings are not available if @onscreen{Enable
103+
keybindings in menus} is enabled.}
104+
69105
And finally, the authoritative source for keybindings
70106
is the @onscreen{Edit} menu's @onscreen{Show Active Keybindings}
71107
menu item. Keybindings in DrRacket are often sensitive to
@@ -77,38 +113,38 @@ selected.
77113
@section{Moving Around}
78114

79115
@itemize[
80-
@keybinding["C-f"]{move forward one character}
81-
@keybinding["C-b"]{move backward one character}
82-
@keybinding["M-f"]{move forward one word}
83-
@keybinding["M-b"]{move backward one word}
84-
@keybinding["C-v"]{move forward one page}
85-
@keybinding["M-v"]{move backward one page}
86-
@keybinding["M-<"]{move to beginning of file}
87-
@keybinding["M->"]{move to end of file}
88-
89-
@keybinding["C-a"]{move to beginning of line (left)}
90-
@keybinding["C-e"]{move to end of line (right)}
91-
@keybinding["C-n"]{move to next line (down)}
92-
@keybinding["C-p"]{move to previous line (up)}
93-
94-
@keybinding["M-C-f"]{move forward one S-expression}
95-
@keybinding["M-C-b"]{move backward one S-expression}
96-
@keybinding["M-C-u"]{move up out of an S-expression}
97-
@keybinding["M-C-d"]{move down into a nested S-expression}
98-
@keybinding["M-C-SPACE"]{select forward S-expression}
99-
@keybinding["M-C-p"]{match parentheses backward}
100-
101-
@keybinding["M-C-left"]{move backwards to the nearest editor box}
102-
@keybinding["A-C-left"]{move backwards to the nearest editor box}
103-
@keybinding["M-C-right"]{move forward to the nearest editor box}
104-
@keybinding["A-C-right"]{move forward to the nearest editor box}
105-
@keybinding["M-C-up"]{move up out of an embedded editor}
106-
@keybinding["A-C-up"]{move up out of an embedded editor}
107-
@keybinding["M-C-down"]{move down into an embedded editor}
108-
@keybinding["A-C-down"]{move down into an embedded editor}
109-
110-
@keybinding["C-C C-Z"]{move the cursor to the interactions window}
111-
@keybinding["C-F6"]{move the cursor between different windows (usually
116+
@keybinding["c:f"]{move forward one character}
117+
@keybinding["c:b"]{move backward one character}
118+
@keybinding["m:f"]{move forward one word}
119+
@keybinding["m:b"]{move backward one word}
120+
@keybinding["c:v"]{move forward one page}
121+
@keybinding["m:v"]{move backward one page}
122+
@keybinding["m:<"]{move to beginning of file}
123+
@keybinding["m:>"]{move to end of file}
124+
125+
@keybinding["c:a"]{move to beginning of line (left)}
126+
@keybinding["c:e"]{move to end of line (right)}
127+
@keybinding["c:n"]{move to next line (down)}
128+
@keybinding["c:p"]{move to previous line (up)}
129+
130+
@keybinding["m:c:f"]{move forward one S-expression}
131+
@keybinding["m:c:b"]{move backward one S-expression}
132+
@keybinding["m:c:u"]{move up out of an S-expression}
133+
@keybinding["m:c:d"]{move down into a nested S-expression}
134+
@keybinding["m:c:space"]{select forward S-expression}
135+
@keybinding["m:c:p"]{match parentheses backward}
136+
137+
@keybinding["m:c:left"]{move backwards to the nearest editor box}
138+
@keybinding["A-c:left"]{move backwards to the nearest editor box}
139+
@keybinding["m:c:right"]{move forward to the nearest editor box}
140+
@keybinding["A-c:right"]{move forward to the nearest editor box}
141+
@keybinding["m:c:up"]{move up out of an embedded editor}
142+
@keybinding["A-c:up"]{move up out of an embedded editor}
143+
@keybinding["m:c:down"]{move down into an embedded editor}
144+
@keybinding["A-c:down"]{move down into an embedded editor}
145+
146+
@keybinding["c:c;c:z"]{move the cursor to the interactions window}
147+
@keybinding["c:F6"]{move the cursor between different windows (usually
112148
the interactions and definitions windows, but also the
113149
search window and other editable portions of DrRacket).
114150
Also, search for ``shift-focus'' in the
@@ -119,45 +155,45 @@ selected.
119155
@section{Editing Operations}
120156

121157
@itemize[
122-
@keybinding["C-_"]{undo}
123-
@keybinding["C-+"]{redo}
124-
@keybinding["C-x u"]{undo}
125-
126-
@keybinding["C-d"]{delete forward one character}
127-
@keybinding["C-h"]{delete backward one character}
128-
@keybinding["M-d"]{delete forward one word}
129-
@keybinding["M-DEL"]{delete backward one word}
130-
@keybinding["C-k"]{delete forward to end of line}
131-
@keybinding["M-C-k"]{delete forward one S-expression}
132-
133-
@keybinding["M-w"]{copy selection to clipboard}
134-
@keybinding["C-w"]{delete selection to clipboard (cut)}
135-
@keybinding["C-y"]{paste from clipboard (yank)}
136-
137-
@keybinding["C-t"]{transpose characters}
138-
@keybinding["M-t"]{transpose words}
139-
@keybinding["M-C-t"]{transpose sexpressions}
140-
141-
@keybinding["M-C-m"]{toggle dark green marking of matching parenthesis}
142-
@keybinding["M-C-k"]{cut complete sexpression}
143-
144-
@keybinding["M-("]{wrap selection in parentheses}
145-
@keybinding["M-["]{wrap selection in square brackets}
146-
@keybinding["M-{"]{wrap selection in curly brackets}
147-
@keybinding["M-S-L"]{wrap selection in @litchar{(lambda () }...@litchar{)}
158+
@keybinding["c:_"]{undo}
159+
@keybinding["c:+"]{redo}
160+
@keybinding["c:x;u"]{undo}
161+
162+
@keybinding["c:d"]{delete forward one character}
163+
@keybinding["c:h"]{delete backward one character}
164+
@keybinding["m:d"]{delete forward one word}
165+
@keybinding["m:delete"]{delete backward one word}
166+
@keybinding["c:k"]{delete forward to end of line}
167+
@keybinding["m:c:k"]{delete forward one S-expression}
168+
169+
@keybinding["m:w"]{copy selection to clipboard}
170+
@keybinding["c:w"]{delete selection to clipboard (cut)}
171+
@keybinding["c:y"]{paste from clipboard (yank)}
172+
173+
@keybinding["c:t"]{transpose characters}
174+
@keybinding["m:t"]{transpose words}
175+
@keybinding["m:c:t"]{transpose sexpressions}
176+
177+
@keybinding["m:c:m"]{toggle dark green marking of matching parenthesis}
178+
@keybinding["m:c:k"]{cut complete sexpression}
179+
180+
@keybinding["m:("]{wrap selection in parentheses}
181+
@keybinding["m:["]{wrap selection in square brackets}
182+
@keybinding["m:{"]{wrap selection in curly brackets}
183+
@keybinding["m:s:l"]{wrap selection in @litchar{(lambda () }...@litchar{)}
148184
and put the insertion point in the argument list of the lambda}
149185

150-
@keybinding["C-c C-o"]{the sexpression following the
186+
@keybinding["c:c;c:o"]{the sexpression following the
151187
insertion point is put in place of its containing sexpression}
152-
@keybinding["C-c C-e"]{the first and last characters (usually parentheses)
188+
@keybinding["c:c;c:e"]{the first and last characters (usually parentheses)
153189
of the containing expression are removed}
154-
@keybinding["C-c C-l"]{wraps a let around the
190+
@keybinding["c:cc;:l"]{wraps a let around the
155191
sexpression following the insertion point and puts a printf in at
156192
that point (useful for debugging).}
157193

158-
@keybinding["M-o"]{toggle @as-index{overwrite mode}}
194+
@keybinding["m:o"]{toggle @as-index{overwrite mode}}
159195

160-
@keybinding["C-x r a"]{Adjust nearby ASCII art rectangles
196+
@keybinding["c:x;r;a"]{Adjust nearby ASCII art rectangles
161197
(that use @litchar{+}, @litchar{-}, or @litchar{|})
162198
to use Unicode characters.
163199

@@ -174,7 +210,7 @@ selected.
174210
the Unicode characters.
175211
}
176212

177-
@keybinding["C-x r w"]{Widen the nearby ASCII art rectangles.
213+
@keybinding["c:x;r;w"]{Widen the nearby ASCII art rectangles.
178214

179215
For example, if the insertion point is just to the left of
180216
the middle line of this rectangle:
@@ -190,7 +226,7 @@ selected.
190226
(list @litchar{║ ║ ║})
191227
(list @litchar{╚══╩══╝}))]
192228
}
193-
@keybinding["C-x r v"]{Make the nearby ASCII art rectangles taller.
229+
@keybinding["c:x;r;v"]{Make the nearby ASCII art rectangles taller.
194230

195231
For example, if the insertion point is just above the
196232
the middle line of this rectangle:
@@ -209,10 +245,10 @@ selected.
209245
(list @litchar{║ ║ ║})
210246
(list @litchar{╚══╩══╝}))]
211247
}
212-
@keybinding["C-x r c"]{Centers the contents of the current line inside the enclosing
248+
@keybinding["c:x;r;c"]{Centers the contents of the current line inside the enclosing
213249
cell of the enclosing ASCII art rectangle.}
214250

215-
@keybinding["C-x r o"]{
251+
@keybinding["c:x;r;o"]{
216252
Toggles the ASCII art rectangle editing mode. When the mode is enabled,
217253
key strokes that would normally break the rectangles instead enlarge them.
218254
Specifically:
@@ -230,21 +266,21 @@ selected.
230266
@section{File Operations}
231267

232268
@itemize[
233-
@keybinding["C-x C-s"]{save file}
234-
@keybinding["C-x C-w"]{save file under new name}
269+
@keybinding["c:x;c:s"]{save file}
270+
@keybinding["c:x;c:w"]{save file under new name}
235271
]
236272

237273
@section{Search}
238274

239275
@itemize[
240-
@keybinding["C-s"]{search for string forward}
241-
@keybinding["C-r"]{search for string backward}
276+
@keybinding["c:s"]{search for string forward}
277+
@keybinding["c:r"]{search for string backward}
242278
]
243279

244280
@section{Evaluation}
245281

246282
@itemize[
247-
@keybinding["F5"]{Run}
283+
@keybinding["f5"]{Run}
248284
]
249285

250286
@section{Documentation}
@@ -261,10 +297,10 @@ The @tech{interactions window} has all of the same keyboard shortcuts
261297
as the @tech{definitions window} plus a few more:
262298

263299
@itemize[
264-
@keybinding["M-p"]{bring the previously entered expression down to the prompt}
265-
@keybinding["M-n"]{bring the expression after the current expression in the
300+
@keybinding["m:p"]{bring the previously entered expression down to the prompt}
301+
@keybinding["m:n"]{bring the expression after the current expression in the
266302
expression history down to the prompt}
267-
@keybinding["M-h"]{Show the current expression history in a separate window}
303+
@keybinding["m:h"]{Show the current expression history in a separate window}
268304
]
269305

270306
Also, in the interactions window, the return key is treated
@@ -291,7 +327,7 @@ not. There are three cases:
291327
@section{LaTeX and TeX inspired keybindings}
292328

293329
@itemize[
294-
@keybinding['("C-\\" "M-\\" "c:x;l")]{traces backwards from the insertion
330+
@keybinding['("c:\\" "m:\\" "c:x;l")]{traces backwards from the insertion
295331
point, looking for a backslash followed by a @index["LaTeX"]{LaTeX}
296332
macro name or a prefix of such a name. If a macro name is found,
297333
it replaces the backslash and the name with the corresponding key in

0 commit comments

Comments
 (0)