9. Default Key Bindings
9.1. Rationale Used in Binding Tables Below
As you can see if you look below, the binding tables have the “Key” column followed by modifier keys in the sequence:
S (Shift)
C (Ctrl)
A (Alt)
The reason they are in this sequence is by convention of thinking about them as though they had a “level of severity” of modifying the meaning of the original keystroke. Note that this is only ONE way of thinking about these modifiers, but it is common because it is intuitive.
The concept includes:
that each “base key” has a topic related to the software application,
that all modifiers used with that key begin an action related to that topic, and
the modifiers make up a progressively increasing quality of some type, which for lack of a better term, we will call “level of severity”.
In alignment with this, let’s build a table where we can illustrate with an example.
S |
C |
A |
Level of Severity |
Example |
|---|---|---|---|---|
0 |
Check syntax of a single file |
|||
x |
1 |
Check syntax of project |
||
x |
2 |
Compile single file |
||
x |
x |
3 |
Compile project |
|
x |
4 |
Compile single file for debugging |
||
x |
x |
5 |
Compile project for debugging |
|
x |
x |
6 |
Compile project for debugging, and program microcontroller |
|
x |
x |
x |
7 |
Compile project for debugging, program microcontroller, and start debugging |
Notice in the pattern above that Alt always means “the compiler should output in debugging format”, and Shift (most of the time) means “whole project” vs “single file”. When key-combination meanings can be organized like that, it makes it more intuitive for the user, and easier to remember.
Also notice that the pattern of ‘x’es in the table above progresses like the bits in an integer, providing up to 8 combinations for every “base key”:
Bits |
Decimal Value |
|---|---|
000 |
0 |
001 |
1 |
010 |
2 |
011 |
3 |
100 |
4 |
101 |
5 |
110 |
6 |
111 |
7 |
9.2. Named-Key Bindings
Most of the behaviors of the named keys (e.g. Enter, Delete, Backspace, Esc) are obvious if only due to tradition that virtually all editors and IDEs have adopted (excepting vim and Emacs). Generally all normal key meanings apply, like holding down the Ctrl key while typing movement keys moves the cursor by whole words or scrolls the screen, while holding the Shift key for movement keys extends the selection area.
However, there are some behaviors that are not obvious, and they are documented in the table below.
Key:
S = Shift
C = Ctrl
A = Alt
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
Up |
x |
x |
swap line up |
|
Down |
x |
x |
swap line down |
|
Up |
x |
x |
add new selection up |
|
Down |
x |
x |
add new selection down |
|
Left |
x |
move left by sub-words (cf ctrl+left = whole words) |
||
Right |
x |
move right by sub-words (cf ctrl+right = whole words) |
||
Ins |
x |
copy (traditional from Win 3.1 era) |
||
Ins |
x |
paste (traditional from Win 3.1 era) |
||
PgUp |
x |
move to previous View |
||
PgDn |
x |
move to next View |
||
Space |
x |
autocomplete |
||
Del |
x |
cut (to clipboard) |
||
Tab |
x |
next View in stack |
||
Tab |
x |
x |
previous View in stack |
|
Enter |
in comment beginning with |
|||
Enter |
in Find panel: find next |
|||
Enter |
in Find-in-Files Panel: find all |
|||
Enter |
x |
insert blank line below w/o changing current line |
||
Enter |
x |
x |
insert blank line above w/o changing current line |
|
Enter |
x |
in Find panel: find previous |
||
Enter |
x |
in Find-in-Files Panel: find all and close panel |
||
Enter |
x |
x |
in Find-in-Files Panel: replace all and close panel |
|
Enter |
x |
x |
in Find-in-Files Panel: replace all and close panel |
Note
[Keypad Enter] key is read as a separate key, but by default, is mapped to the exact same commands as the [Enter] key, including all modifier keys.
9.3. Tab Key
The [Tab] key’s behavior is context sensitive.
if an auto-complete pop-up is visible, commits autocomplete selected;
if in a snippet and there is a next field, advances to next field;
if an Overlay Panel has focus, causes caret to jump to next field;
if:
settings.auto_indent,all selections are empty, and
caret is on an empty line, then
reindent;
if:
auto_complete_visible== false,all selections are empty,
setting.tab_completion== false, andcaret is after [A-Za-z0-9_], then auto-complete in “snippet” mode (attempt to pull up a snippet);
if:
auto_complete_visible== false,all selections are empty,
setting.tab_completion== true, andcaret is after [A-Za-z0-9_], then autocomplete in “mini” mode;
otherwise, insert ‘\t’ character.
and most of the above are reversed when the shift key is held down.
9.4. Default F-Key Bindings
The following a human-readable map of the F-keys
from <install_path>/Packages/Default ($platform).sublime-keymap.
A blank line means the key is not mapped in this Keymap.
Key:
S = Shift
C = Ctrl
A = Alt
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
F1 |
||||
F2 |
next_bookmark |
|||
F2 |
x |
prev_bookmark |
||
F2 |
x |
toggle_bookmark (toggle_line: true) |
||
F2 |
x |
x |
clear_bookmarks |
|
F2 |
x |
select_all_bookmarks |
||
F3 |
find_next |
|||
F3 |
x |
find_prev |
||
F3 |
x |
find_under |
||
F3 |
x |
x |
find_under_prev |
|
F3 |
x |
find_all_under |
||
F4 |
next_result |
|||
F4 |
x |
prev_result |
||
F4 |
x |
close_file |
||
F5 |
||||
F6 |
toggle_setting (spell_check) |
|||
F6 |
x |
next_misspelling |
||
F6 |
x |
x |
prev_misspelling |
|
F7 |
build |
|||
F8 |
||||
F9 |
sort_lines (case_sensitive: false) |
|||
F9 |
x |
sort_lines (case_sensitive: true) |
||
F10 |
x |
context_menu |
||
F11 |
toggle_full_screen |
|||
F11 |
x |
toggle_distraction_free |
||
F12 |
goto_definition |
|||
F12 |
x |
goto_definition (side_by_side: true) |
||
F12 |
x |
goto_reference |
||
F12 |
x |
x |
goto_reference (side_by_side: true) |
|
F12 |
auto_complete_open_link (when auto_complete_visible) |
9.5. Default Letter-Key Bindings
The following is info from egrep of the default .sublime-keymap involving
letter-keys:
Key:
S = Shift
C = Ctrl
A = Alt
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
A |
x |
select all |
||
A |
x |
x |
expand selection (smart) |
|
A |
x |
toggle preserve case |
||
B |
x |
build |
||
C |
x |
copy (to clipboard) |
||
D |
x |
find under expand |
||
D |
x |
x |
duplicate line |
|
E |
x |
slurp find string |
||
E |
x |
x |
slurp replace string |
|
F |
x |
show find panel |
||
F |
x |
x |
show find-in-files panel |
|
G |
x |
show Goto Overlay Panel with “text”: “:” |
||
H |
x |
show replace panel |
||
H |
x |
x |
show replace panel (reverse) |
|
I |
x |
show incremental-find panel |
||
I |
x |
x |
show incremental-find panel (reverse) |
|
J |
x |
x |
join lines |
|
L |
x |
expand selection to line |
||
L |
x |
x |
split selection into lines |
|
L |
x |
expand selection to previous line |
||
M |
x |
move to brackets |
||
M |
x |
x |
expand selection to brackets |
|
N |
x |
new file |
||
N |
x |
x |
new window |
|
O |
x |
open-file dialog box |
||
O |
x |
switch file to next C-family file (c;h;cpp;hpp;etc) |
||
O |
x |
x |
switch file to next C-family file (side-by-side) |
|
P |
x |
show files overlay |
||
P |
x |
x |
show Command Palette overlay |
|
P |
x |
x |
open switch-project dialog box |
|
P |
x |
x |
x |
show scope name at caret |
Q |
x |
toggle record macro (mod: moved to alt-f10) |
||
Q |
x |
x |
run macro |
|
Q |
x |
wrap lines @ ruler |
||
R |
x |
show Goto Overlay Panel with “text”: “@” |
||
R |
x |
x |
goto symbol in project (w drop-down symbol list) |
|
R |
x |
toggle regex in find panel (mod: wrap text @ ruler) |
||
S |
x |
save current buffer |
||
S |
x |
x |
save as... (mod: save all) |
|
T |
x |
transpose (swap current and previous character) |
||
T |
x |
x |
re-open most-recently-closed file |
|
U |
x |
soft redo (includes changes to selection) |
||
U |
x |
x |
soft undo (includes changes to selection) |
|
V |
x |
paste (from clipboard) |
||
V |
x |
x |
paste and indent |
|
W |
x |
close View |
||
W |
x |
x |
close Window |
|
X |
x |
cut |
||
Y |
x |
redo (reverses undo) |
||
Z |
x |
undo |
||
Z |
x |
x |
redo (same as ctrl+y) |
9.6. Default Number-Key Bindings
The following is info from egrep of the default .sublime-keymap involving
number keys:
Key:
S = Shift
C = Ctrl
A = Alt
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
1-8 |
x |
select by index (group 0-7) |
||
9 |
x |
select by index (last group) |
||
1-9 |
x |
focus group 0-8 (when group has multi-select) |
||
0 |
x |
focus group 9 (when group has multi-select) |
||
1-5 |
x |
x |
change View layout |
|
8-9 |
x |
x |
change View layout |
|
1-9 |
x |
focus group 0-8 |
||
1-9 |
x |
x |
move to group 0-8 |
|
0 |
x |
move focus to side bar |
9.7. Default Symbol-Key Bindings
The following is info from egrep of the default .sublime-keymap involving
symbol keys (i.e. `,
-, =, [, ], \, ;, ', ,, ., /,
kp/, kp*, kp-, kp+):
Key:
S = Shift
C = Ctrl
A = Alt
kp = Keypad (e.g.
kp+meanskeypad_plus)
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
` |
x |
open and/or move keyboard focus to Console Overlay Panel |
||
- |
x |
jump_back |
||
- |
x |
x |
jump_forward |
|
- |
x |
decrease font size |
||
= |
x |
increase font size |
||
[ |
x |
unindent |
||
[ |
insert_snippet [$0] [1] |
|||
[ |
insert_snippet [${0:$SELECTION}] [2] |
|||
[ |
x |
x |
fold |
|
] |
x |
indent |
||
] |
move (forward by 1 character) [3] |
|||
] |
x |
x |
unfold |
|
\ |
not mapped |
|||
; |
x |
show Goto Overlay Panel with “text”: “#” |
||
‘ |
insert_snippet '$0' (auto-pair single quotes) [4] |
|||
‘ |
insert_snippet '${0:$SELECTION}' [5] |
|||
‘ |
move (forward by 1 character) [6] |
|||
‘ |
x |
insert_snippet "$0" (auto-pair double quotes) [7] |
||
‘ |
x |
insert_snippet "${0:$SELECTION}" [8] |
||
‘ |
x |
move (forward by 1 character) [9] |
||
, |
x |
prev_modification |
||
. |
x |
next_modification |
||
/ |
x |
toggle_comment (“block”: false) |
||
/ |
x |
x |
toggle_comment (“block”: true) |
|
/ |
close_tag (“insert_slash”: true) [10] |
|||
kp/ |
not mapped |
|||
kp* |
not mapped |
|||
kp- |
x |
jump_back |
||
kp- |
x |
x |
jump_forward |
|
kp- |
x |
decrease_font_size |
||
kp+ |
x |
increase_font_size |
||
kp+ |
x |
x |
decrease_font_size |
9.8. Ctrl+J Primary
ctrl+j is now used as the primary key in multiple-key sequences.
ctrl+j ctrl+j now opens a message box that explains how the previous
binding of ctrl+j (join lines) was switched to ctrl+shift+j.
Now when ctrl+j is pressed the first time, it arms the key-reader to watch for
one of the following key sequences. If it isn’t one of them, nothing happens.
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
Up |
x |
deselect others |
||
Left |
x |
deselect to left |
||
Left |
x |
x |
select to left |
|
Right |
x |
deselect to right |
||
Right |
x |
x |
select to right |
|
PgUp |
x |
focus to left |
||
PgDn |
x |
focus to right |
||
J |
x |
open message box explaining |
9.9. Ctrl+K Primary
ctrl+k is used as the primary key in multiple-key sequences.
When ctrl+k is pressed the first time, it arms the key-reader to watch for
one of the following key sequences. If it isn’t one of them, nothing happens.
Key |
S |
C |
A |
Command |
|---|---|---|---|---|
Up |
x |
new pane |
||
Up |
x |
x |
new pane (no move) |
|
Down |
x |
close pane |
||
Left |
x |
focus on previous group |
||
Left |
x |
x |
move to previous neighboring group |
|
Right |
x |
focus on next group |
||
Right |
x |
x |
move to next neighboring group |
|
1-9 |
x |
fold by level |
||
0 |
x |
unfold all |
||
A |
x |
select to mark |
||
B |
x |
toggle side bar (open/closed) |
||
C |
x |
scroll to put caret at vertical center of View |
||
D |
x |
find under expand skip |
||
G |
x |
clear bookmarks |
||
J |
x |
unfold all |
||
K |
x |
run macro Delete to Hard EOL |
||
L |
x |
lower case |
||
T |
x |
fold tag attributes |
||
U |
x |
upper case |
||
V |
x |
paste from history |
||
W |
x |
delete to mark |
||
X |
x |
swap with mark |
||
Y |
x |
yank |
||
Z |
x |
revert hunk (contiguous whole-line changes) |
||
Z |
x |
x |
revert modification (individual modification) |