Skip to content

Commit cdc9728

Browse files
authored
emacs: Support more default keybindings (#40101)
Hello, Thanks for the great work. I am adding some more bindings for the emacs keymap: - `command_palette::Toggle` as replacement for the emacs command dispatcher - other default aliases for existing move / delete commands - e.g. `alt-left` to move to previous word and `alt-del` to delete it - some missing `SelectTo` equivalents for move commands on selection mode Release Notes: - Added bindings for the Emacs keymap
1 parent aec3c2f commit cdc9728

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

assets/keymaps/linux/emacs.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
{
1212
"context": "Editor",
1313
"bindings": {
14+
"alt-x": "command_palette::Toggle",
1415
"ctrl-g": "editor::Cancel",
1516
"ctrl-x b": "tab_switcher::Toggle", // switch-to-buffer
17+
"ctrl-x ctrl-b": "tab_switcher::Toggle", // list-buffers
1618
"alt-g g": "go_to_line::Toggle", // goto-line
1719
"alt-g alt-g": "go_to_line::Toggle", // goto-line
1820
"ctrl-space": "editor::SetMark", // set-mark
@@ -29,6 +31,8 @@
2931
"shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line
3032
"shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line
3133
"alt-m": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false, "stop_at_indent": true }], // back-to-indentation
34+
"alt-left": "editor::MoveToPreviousWordStart", // left-word
35+
"alt-right": "editor::MoveToNextWordEnd", // right-word
3236
"alt-f": "editor::MoveToNextSubwordEnd", // forward-word
3337
"alt-b": "editor::MoveToPreviousSubwordStart", // backward-word
3438
"alt-u": "editor::ConvertToUpperCase", // upcase-word
@@ -43,6 +47,8 @@
4347
"ctrl-x h": "editor::SelectAll", // mark-whole-buffer
4448
"ctrl-d": "editor::Delete", // delete-char
4549
"alt-d": ["editor::DeleteToNextWordEnd", { "ignore_newlines": false, "ignore_brackets": false }], // kill-word
50+
"alt-backspace": "editor::DeleteToPreviousWordStart", // backward-kill-word
51+
"alt-delete": "editor::DeleteToPreviousWordStart", // backward-kill-word
4652
"ctrl-k": "editor::KillRingCut", // kill-line
4753
"ctrl-w": "editor::Cut", // kill-region
4854
"alt-w": "editor::Copy", // kill-ring-save
@@ -52,14 +58,19 @@
5258
"ctrl-x u": "editor::Undo", // undo
5359
"alt-{": "editor::MoveToStartOfParagraph", // backward-paragraph
5460
"alt-}": "editor::MoveToEndOfParagraph", // forward-paragraph
61+
"ctrl-up": "editor::MoveToStartOfParagraph", // backward-paragraph
62+
"ctrl-down": "editor::MoveToEndOfParagraph", // forward-paragraph
5563
"ctrl-v": "editor::MovePageDown", // scroll-up
5664
"alt-v": "editor::MovePageUp", // scroll-down
5765
"ctrl-x [": "editor::MoveToBeginning", // beginning-of-buffer
5866
"ctrl-x ]": "editor::MoveToEnd", // end-of-buffer
5967
"alt-<": "editor::MoveToBeginning", // beginning-of-buffer
6068
"alt->": "editor::MoveToEnd", // end-of-buffer
69+
"ctrl-home": "editor::MoveToBeginning", // beginning-of-buffer
70+
"ctrl-end": "editor::MoveToEnd", // end-of-buffer
6171
"ctrl-l": "editor::ScrollCursorCenterTopBottom", // recenter-top-bottom
6272
"ctrl-s": "buffer_search::Deploy", // isearch-forward
73+
"ctrl-r": "buffer_search::Deploy", // isearch-backward
6374
"alt-^": "editor::JoinLines", // join-line
6475
"alt-q": "editor::Rewrap" // fill-paragraph
6576
}
@@ -85,10 +96,19 @@
8596
"end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
8697
"ctrl-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
8798
"ctrl-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
99+
"alt-m": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false, "stop_at_indent": true }],
88100
"alt-f": "editor::SelectToNextWordEnd",
89101
"alt-b": "editor::SelectToPreviousSubwordStart",
102+
"alt-{": "editor::SelectToStartOfParagraph",
103+
"alt-}": "editor::SelectToEndOfParagraph",
104+
"ctrl-up": "editor::SelectToStartOfParagraph",
105+
"ctrl-down": "editor::SelectToEndOfParagraph",
106+
"ctrl-x [": "editor::SelectToBeginning",
107+
"ctrl-x ]": "editor::SelectToEnd",
90108
"alt-<": "editor::SelectToBeginning",
91109
"alt->": "editor::SelectToEnd",
110+
"ctrl-home": "editor::SelectToBeginning",
111+
"ctrl-end": "editor::SelectToEnd",
92112
"ctrl-g": "editor::Cancel"
93113
}
94114
},

assets/keymaps/macos/emacs.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
{
1313
"context": "Editor",
1414
"bindings": {
15+
"alt-x": "command_palette::Toggle",
1516
"ctrl-g": "editor::Cancel",
1617
"ctrl-x b": "tab_switcher::Toggle", // switch-to-buffer
18+
"ctrl-x ctrl-b": "tab_switcher::Toggle", // list-buffers
1719
"alt-g g": "go_to_line::Toggle", // goto-line
1820
"alt-g alt-g": "go_to_line::Toggle", // goto-line
1921
"ctrl-space": "editor::SetMark", // set-mark
@@ -30,6 +32,8 @@
3032
"shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line
3133
"shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line
3234
"alt-m": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false, "stop_at_indent": true }], // back-to-indentation
35+
"alt-left": "editor::MoveToPreviousWordStart", // left-word
36+
"alt-right": "editor::MoveToNextWordEnd", // right-word
3337
"alt-f": "editor::MoveToNextSubwordEnd", // forward-word
3438
"alt-b": "editor::MoveToPreviousSubwordStart", // backward-word
3539
"alt-u": "editor::ConvertToUpperCase", // upcase-word
@@ -44,6 +48,8 @@
4448
"ctrl-x h": "editor::SelectAll", // mark-whole-buffer
4549
"ctrl-d": "editor::Delete", // delete-char
4650
"alt-d": ["editor::DeleteToNextWordEnd", { "ignore_newlines": false, "ignore_brackets": false }], // kill-word
51+
"alt-backspace": "editor::DeleteToPreviousWordStart", // backward-kill-word
52+
"alt-delete": "editor::DeleteToPreviousWordStart", // backward-kill-word
4753
"ctrl-k": "editor::KillRingCut", // kill-line
4854
"ctrl-w": "editor::Cut", // kill-region
4955
"alt-w": "editor::Copy", // kill-ring-save
@@ -53,14 +59,19 @@
5359
"ctrl-x u": "editor::Undo", // undo
5460
"alt-{": "editor::MoveToStartOfParagraph", // backward-paragraph
5561
"alt-}": "editor::MoveToEndOfParagraph", // forward-paragraph
62+
"ctrl-up": "editor::MoveToStartOfParagraph", // backward-paragraph
63+
"ctrl-down": "editor::MoveToEndOfParagraph", // forward-paragraph
5664
"ctrl-v": "editor::MovePageDown", // scroll-up
5765
"alt-v": "editor::MovePageUp", // scroll-down
5866
"ctrl-x [": "editor::MoveToBeginning", // beginning-of-buffer
5967
"ctrl-x ]": "editor::MoveToEnd", // end-of-buffer
6068
"alt-<": "editor::MoveToBeginning", // beginning-of-buffer
6169
"alt->": "editor::MoveToEnd", // end-of-buffer
70+
"ctrl-home": "editor::MoveToBeginning", // beginning-of-buffer
71+
"ctrl-end": "editor::MoveToEnd", // end-of-buffer
6272
"ctrl-l": "editor::ScrollCursorCenterTopBottom", // recenter-top-bottom
6373
"ctrl-s": "buffer_search::Deploy", // isearch-forward
74+
"ctrl-r": "buffer_search::Deploy", // isearch-backward
6475
"alt-^": "editor::JoinLines", // join-line
6576
"alt-q": "editor::Rewrap" // fill-paragraph
6677
}
@@ -86,10 +97,19 @@
8697
"end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
8798
"ctrl-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
8899
"ctrl-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
100+
"alt-m": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false, "stop_at_indent": true }],
89101
"alt-f": "editor::SelectToNextWordEnd",
90102
"alt-b": "editor::SelectToPreviousSubwordStart",
103+
"alt-{": "editor::SelectToStartOfParagraph",
104+
"alt-}": "editor::SelectToEndOfParagraph",
105+
"ctrl-up": "editor::SelectToStartOfParagraph",
106+
"ctrl-down": "editor::SelectToEndOfParagraph",
107+
"ctrl-x [": "editor::SelectToBeginning",
108+
"ctrl-x ]": "editor::SelectToEnd",
91109
"alt-<": "editor::SelectToBeginning",
92110
"alt->": "editor::SelectToEnd",
111+
"ctrl-home": "editor::SelectToBeginning",
112+
"ctrl-end": "editor::SelectToEnd",
93113
"ctrl-g": "editor::Cancel"
94114
}
95115
},

0 commit comments

Comments
 (0)