-
Notifications
You must be signed in to change notification settings - Fork 512
Keystrokes
Keystrokes are the way you describe key combinations to Slate. This page describes them in detail.
Keystrokes are used in the slate.bind
function
slate.bind(keystroke, operation);
This will bind operation
to run when they key combination described by keystroke
is pressed.
There are two types of keystrokes. Normal and Modal.
Normal keystrokes activate as you might expect: when the keystroke is pressed, the binding activates.
Normal keystrokes are Strings in the following form:
"key:modifiers"
-
key
is one of the Allowed Keys -
modifiers
is a comma or semicolon separated list of standard modifier keys:- Control:
ctrl
- Option/Alt:
alt
- Command:
cmd
- Shift:
shift
- Control:
"1:ctrl"
- represents pressing 1
and the modifier Control simultaneously
"pad1:ctrl,shift"
- represents pressing the 1
key on the number pad and the modifiers Control and Shift all simultaneously
"f10:alt,cmd,ctrl"
- represents pressing the f10
key and the modifiers Option/Alt, Command and Control all simultaneously
Modal keystrokes activate by defining a modal keystroke that will put Slate into Modal Mode. When in this mode, Slate's menu bar icon will turn blue and Slate will listen for another key press to activate the binding. Once a binding is activated, Modal Mode will end. You may also specify an option that will cause Modal Mode to not exit when the binding is pressed. Instead it will exit if you press the modal keystroke again or use the config modalEscapeKey
to specify a modal escape key.
Modal Keystrokes are strings in the following form:
key:modal-keystroke[:toggle]
-
key
is one of the Allowed Keys. This is the key that will activate the binding after the modal keystroke is pressed -
modal-keystroke
is a comma or semicolon separated list of one of the Allowed Keys and any number of standard modifier keys. Possible standard modifier keys are:- Control:
ctrl
- Option/Alt:
alt
- Command:
cmd
- Shift:
shift
- Control:
"1:f4"
- represents pressing the f4
key to activate Modal Mode, then pressing 1
. This will cause Modal Mode to end.
"1:f4:toggle"
- represents pressing the f4
key to activate Modal Mode, then pressing 1
. This will not cause Modal Mode to end, allowing you to press 1
again to activate the binding again without having to press f4
.
"1:f4,ctrl"
- represents pressing the f4
key and the modifier Control simultaneously to activate Modal Mode, then pressing 1
. This will cause Modal Mode to end after the binding is activated.
"1:f4,ctrl:toggle"
- represents pressing the f4
key and the modifier Control simultaneously to activate Modal Mode, then pressing 1
. This will not cause Modal Mode to end after the binding is activated, allowing you to press 1
again to activate the binding again without having to press f4
.
Note: If you bind any binding to cmd-tab or cmd-shift-tab, Slate will completely disable the default Mac OS X Application switcher!
'
,
-
.
/
0
1
2
3
4
5
6
7
8
9
;
=
`
a
b
backslash
c
caps
d
delete
down
e
end
esc
f
f1
f10
f11
f12
f13
f14
f15
f16
f17
f18
f19
f2
f20
f3
f4
f5
f6
f7
f8
f9
g
h
help
home
i
j
k
l
left
m
mute
n
o
p
pad*
pad+
pad-
pad.
pad/
pad0
pad1
pad2
pad3
pad4
pad5
pad6
pad7
pad8
pad9
pad=
padClear
padEnter
pageDown
pageUp
q
r
return
right
s
space
t
tab
u
up
v
w
x
y
z
[
]