Skip to content

Commit dba95f5

Browse files
lesleyrsthe-mikedavis
authored andcommitted
Add shift-backspace keybind alias for backspace (#4937)
When the Kitty Keyboard Protocol is enabled, S-backspace is distinguished from backspace with no modifiers. This is awkward when typing because it's very easy to accidentally hold shift and press backspace temporarily when typing capital letters. Kakoune (which is also a Kitty Keyboard Protocol application) treats S-backspace as backspace too: https://github.com/mawww/kakoune/blob/3150e9b3cd8e61d9bc68245d67822614d4376cf4/src/input_handler.cc#L1275
1 parent a5c2d18 commit dba95f5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

book/src/keymap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ experience.
350350
| `Alt-d`, `Alt-Delete` | Delete next word | `delete_word_forward` |
351351
| `Ctrl-u` | Delete to start of line | `kill_to_line_start` |
352352
| `Ctrl-k` | Delete to end of line | `kill_to_line_end` |
353-
| `Ctrl-h`, `Backspace` | Delete previous char | `delete_char_backward` |
353+
| `Ctrl-h`, `Backspace`, `Shift-Backspace` | Delete previous char | `delete_char_backward` |
354354
| `Ctrl-d`, `Delete` | Delete next char | `delete_char_forward` |
355355
| `Ctrl-j`, `Enter` | Insert new line | `insert_newline` |
356356

@@ -431,7 +431,7 @@ Keys to use within prompt, Remapping currently not supported.
431431
| `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | Delete next word |
432432
| `Ctrl-u` | Delete to start of line |
433433
| `Ctrl-k` | Delete to end of line |
434-
| `Backspace`, `Ctrl-h` | Delete previous char |
434+
| `Backspace`, `Ctrl-h`, `Shift-Backspace` | Delete previous char |
435435
| `Delete`, `Ctrl-d` | Delete next char |
436436
| `Ctrl-s` | Insert a word under doc cursor, may be changed to Ctrl-r Ctrl-w later |
437437
| `Ctrl-p`, `Up` | Select previous history |

helix-term/src/keymap/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ pub fn default() -> HashMap<Mode, Keymap> {
363363
"A-d" | "A-del" => delete_word_forward,
364364
"C-u" => kill_to_line_start,
365365
"C-k" => kill_to_line_end,
366-
"C-h" | "backspace" => delete_char_backward,
366+
"C-h" | "backspace" | "S-backspace" => delete_char_backward,
367367
"C-d" | "del" => delete_char_forward,
368368
"C-j" | "ret" => insert_newline,
369369
"tab" => insert_tab,

helix-term/src/ui/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl Component for Prompt {
516516
alt!('d') | alt!(Delete) | ctrl!(Delete) => self.delete_word_forwards(cx.editor),
517517
ctrl!('k') => self.kill_to_end_of_line(cx.editor),
518518
ctrl!('u') => self.kill_to_start_of_line(cx.editor),
519-
ctrl!('h') | key!(Backspace) => {
519+
ctrl!('h') | key!(Backspace) | shift!(Backspace) => {
520520
self.delete_char_backwards(cx.editor);
521521
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
522522
}

0 commit comments

Comments
 (0)