forked from Binocular222/Sublime-Text-3-Full-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Key Binding.txt
151 lines (147 loc) · 13.1 KB
/
Key Binding.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Map key presses to commands
Can have double keyboard shortcut, i.e: Ctrl+k Ctrl+b = Hold Ctrl, press k then b quickly will show sidebar
Stored in
Default (Windows).sublime-keymap
Default (OSX).sublime-keymap
Default (Linux).sublime-keymap
Format: JSON
Example:
{
"keys": ["ctrl+enter"], "command": "insert", "args": {"characters": "\n"}, // \n is passed to "insert" command when press Ctrl+Enter
"keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }
]
}
key
An array of case-sensitive keys to be pressed
Chords are built by adding elements to the array, e.g. ["ctrl+k","ctrl+j"] = Hold ctrl down then press "k" and "j"
Ambiguous chords are resolved with a timeout
command = Name of the command to be executed [[Command.txt]]
args = Arguments to be passed to command.
context [Optional] (all must be true to trigger key binding)
key = Name of a context operand to query.
operator = Type of test to perform against key.
equal, not_equal
regex_match, not_regex_match
regex_contains, not_regex_contains
operand = Value against which the result of key is tested.
| auto_complete_visible | true if the autocomplete list is visible. |
| has_next_field | true if a next snippet field is available. |
| has_prev_field | true if a previous snippet field is available. |
| num_selections | the number of selections. |
| overlay_visible | true if any overlay is visible. |
| panel_visible | true if any panel is visible. |
| following_text | Restricts the test just to the text following the caret. |
| preceding_text | Restricts the test just to the text preceding the caret. |
| selection_empty | true if the selection is an empty region. |
| setting.x | the value of the x setting. x can be any string. |
| text | Restricts the test just to the selected text. |
| selector | the current scope. |
| panel_has_focus | true if the current focus is on a panel. |
| panel | true if the panel given as operand is visible. |
| true/false | |
match_all = Requires the test to succeed for all selections.
selector = All selections must match the given selector
allSelectionsEmpty = All selections must be empty
allSelectionsNonEmpty = All selections must be non-empty
allFollowingCharacter = The character to the right of each selection must be equal to the one given
noFollowingCharacter = No character to the right of any selection must be equal to the one given
allPrecedingCharacter = The character to the left of each selection must be equal to the one given
noPrecedingCharacter = No character to the left of any selection must be equal to the one given
option = The given option must have a value of 'true'
notOption = The given option must not have a value of 'true'
canPopSelection = If the selection history can be poped
canUnpopSelection = If the selection history can be unpoped
hasNextField = If a snippet is currently being inserted, and the last field is not active
hasPrevField = If a snippet is currently being inserted, and the first field is not active
newlineInSelection = At least one selection includes a newline
hasMultipleSelections = There is more than one selection
noPrecedingText = For each selection, the text between the beginning of the line and the selection must not match the given regex
allPrecedingText = For each selection, the text between the beginning of the line and the selection must match the given regex
noContainedText = For each selection, the text within the selection must not match the given regex
allContainedText = For each selection, the text within the selection must match the given regex
noFollowingText = For each selection, the text between the selection and the end of the line must not match the given regex
allFollowingText = For each selection, the text between the selection and the end of the line must match the given regex
isPanelVisible = If a panel is open
isOverlayVisible = If an overlay is open (i.e., the quick panel)
isFullScreen = If the current window is in full screen mode
Relevant settings:
command_mode = prevent key presses from being sent to the buffer → useful when emulating Vim
Available keys
up
down
right
left
insert
home
end
pageup
pagedown
backspace
delete
tab
enter
pause
escape
space
keypad0
keypad1
keypad2
keypad3
keypad4
keypad5
keypad6
keypad7
keypad8
keypad9
keypad_period
keypad_divide
keypad_multiply
keypad_minus
keypad_plus
keypad_enter
clear
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
f13
f14
f15
f16
f17
f18
f19
f20
sysreq
break
context_menu
browser_back
browser_forward
browser_refresh
browser_stop
browser_search
browser_favorites
browser_home
Modifiers
shift
ctrl
alt
super (Windows key, Command key...)
Note: If you’re developing a package,
Ctrl+Alt+<alphanum> should not be used for any Windows key bindings.
Option+<alphanum> should not be used for any OS X key bindings.
Because user’s ability to insert non-ASCII characters would be compromised
If you are the end-user, you are free to remap those key combinations.