If you happen to be using Alacritty as your terminal, the following can be added to your user's configuration file (e.g., ~/.config/alacritty/alacritty.toml
):
[[keyboard.bindings]]
chars = "\u0001"
key = "Home"
[[keyboard.bindings]]
chars = "\u0005"
key = "End"
This thread seems to be confused about where to define key-bindings, and thus are surprised when key-bindings work over SSH (or not).
Conceptually, you can define key-bindings in your interactive shell (e.g., ~/.zshrc
, ~/.bashrc
), or a system-wide line editing library like GNU Readline (~/.inputrc
), or even input monitoring tools like X11's bindkeys (/etc/xbindkeysrc
). These will only affect key presses on that single system/shell/library session.
Alternatively, since you typically have a 1:1 correspondence between physical keyboard and terminal software, it makes more sense to define the key-bindings through your terminal's configuration. This way, regardless of which system you happen to be running a shell, the common middleman is your terminal, and the key-bindings will remain effective.
Also, while I believe this is true, I haven't confirmed that: in almost all scenarios your terminal software is going to receive key-press events earlier than any interactive shell/line editor. It makes sense in my mind to handle the key-bindings as early as possible.