Default bindings for token movement commands

There is no natural default binding for token movements. Add the
alt-{left,right,backspace,delete}, breaking some existing behavior.

For example, backward-delete-word is no longer bound to alt-backspace but
only to ctrl-backspace.  Unfortunately some terminals (particularly tmux)
don't support distinguishing ctrl-backspace from ctrl-h yet, so the loss
of alt-backspace may be tragic.

---

I guess we could also add:

    bind alt-B backward-token
    bind alt-F forward-token
    bind ctrl-W backward-kill-token
    bind alt-D kill-token

Those might be intercepted by the terminal on Linux, but I don't know where
that happens.

Tested on foot, kitty, alacritty, xterm, tmux, konsole and gnome-terminal.

Closes #10766
This commit is contained in:
Johannes Altmanninger
2024-10-05 21:44:29 +02:00
parent 2dafe81f97
commit 6af96a81a8
6 changed files with 28 additions and 6 deletions

View File

@@ -74,8 +74,9 @@ function fish_default_key_bindings -d "emacs-like key binds"
bind --preset $argv alt-u upcase-word
bind --preset $argv alt-c capitalize-word
bind --preset $argv alt-backspace backward-kill-word
bind --preset $argv alt-backspace 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
bind --preset $argv alt-b backward-word
bind --preset $argv alt-f forward-word