Add ctrl-alt-h compatibility binding

Historically, ctrl-i sends the same code as tab, ctrl-h sends backspace and
ctrl-j and ctrl-m behave like enter.

Even for terminals that send unambiguous encodings (via the kitty keyboard
protocol), we have kept bindings like ctrl-h, to support existing habits.

We forgot that pressing alt-ctrl-h would behave like alt-backspace (and can
be easier to reach) so maybe we should add that as well.

Don't add ctrl-shift-i because at least on Linux, that's usually intercepted
by the terminal emulator.

Technically there are some more such as "ctrl-2" (which used to do the same as
"ctrl-space") but I don't think anyone uses that over "ctrl-space".

Closes #https://github.com/fish-shell/fish-shell/discussions/11548
This commit is contained in:
Johannes Altmanninger
2025-06-21 14:06:37 +02:00
parent dcd93e4c52
commit 4d67ca7c58

View File

@@ -52,11 +52,13 @@ function fish_default_key_bindings -d "emacs-like key binds"
bind --preset $argv alt-c capitalize-word
if test (__fish_uname) = Darwin
bind --preset $argv alt-backspace backward-kill-word
bind --preset $argv ctrl-alt-h backward-kill-word
bind --preset $argv ctrl-backspace backward-kill-token
bind --preset $argv alt-delete kill-word
bind --preset $argv ctrl-delete kill-token
else
bind --preset $argv alt-backspace backward-kill-token
bind --preset $argv ctrl-alt-h backward-kill-token
bind --preset $argv ctrl-backspace backward-kill-word
bind --preset $argv alt-delete kill-token
bind --preset $argv ctrl-delete kill-word