diff --git a/docs-master/keybindings/Custom_Keybindings.md b/docs-master/keybindings/Custom_Keybindings.md index a2537f069..15fc41d5c 100644 --- a/docs-master/keybindings/Custom_Keybindings.md +++ b/docs-master/keybindings/Custom_Keybindings.md @@ -1,63 +1,96 @@ -## Possible keybindings -| Put in | You will get | -|---------------|----------------| -| `` | F1 | -| `` | F2 | -| `` | F3 | -| `` | F4 | -| `` | F5 | -| `` | F6 | -| `` | F7 | -| `` | F8 | -| `` | F9 | -| `` | F10 | -| `` | F11 | -| `` | F12 | -| `` | Insert | -| `` | Delete | -| `` | Home | -| `` | End | -| `` | Pgup | -| `` | Pgdn | -| `` | ArrowUp | -| `` | ShiftArrowUp | -| `` | ArrowDown | -| `` | ShiftArrowDown | -| `` | ArrowLeft | -| `` | ArrowRight | -| `` | Tab | -| `` | Backtab | -| `` | Enter | -| `` | AltEnter | -| `` | Esc | -| `` | Backspace | -| `` | CtrlSpace | -| `` | CtrlSlash | -| `` | Space | -| `` | CtrlA | -| `` | CtrlB | -| `` | CtrlC | -| `` | CtrlD | -| `` | CtrlE | -| `` | CtrlF | -| `` | CtrlG | -| `` | CtrlJ | -| `` | CtrlK | -| `` | CtrlL | -| `` | CtrlN | -| `` | CtrlO | -| `` | CtrlP | -| `` | CtrlQ | -| `` | CtrlR | -| `` | CtrlS | -| `` | CtrlT | -| `` | CtrlU | -| `` | CtrlV | -| `` | CtrlW | -| `` | CtrlX | -| `` | CtrlY | -| `` | CtrlZ | -| `` | Ctrl4 | -| `` | Ctrl5 | -| `` | Ctrl6 | -| `` | Ctrl8 | +## Custom Keybindings + +A keybinding is one of: + +- A single printable character, e.g. `q`, `?`, `5`. Uppercase letters mean + shift+letter — write `A`, not ``. +- A special key name in angle brackets, e.g. ``, ``, ``. +- A key with modifiers in angle brackets, e.g. `` (Ctrl+C), `` + (Ctrl+Shift+Up). +- The literal string `` to disable a binding. + +### Modifiers + +Prefix a key with one or more modifiers, joined by `-`: + +| Prefix | Long form | Modifier | +| ------ | --------- | ----------------------------------------------------------------------------------------- | +| `c-` | `ctrl-` | Ctrl | +| `a-` | `alt-` | Alt | +| `s-` | `shift-` | Shift | +| `m-` | `meta-` | Depends on terminal; typically ⌘ on macOS or Super/Win key, when the terminal forwards it | + +You can also use `+` instead of `-` as the separator. Modifiers may appear in +any order, and short and long forms can be mixed. The whole binding should be +wrapped in angle brackets when it has any modifiers. The following all express +the same binding: + +- `` +- `` +- `` +- `` + +### Special key names + +| Put in | You will get | +| --------------------------------------- | ------------------- | +| `` – `` | F1 – F12 | +| `` | Insert | +| `` | Delete | +| `` | Home | +| `` | End | +| `` | PageUp | +| `` | PageDown | +| `` | ArrowUp | +| `` | ArrowDown | +| `` | ArrowLeft | +| `` | ArrowRight | +| `` | Tab | +| `` | Shift+Tab | +| `` | Enter | +| `` | Escape | +| `` | Backspace | +| `` | Space | +| ``/`` | Mouse wheel up/down | + +These can be combined with modifiers, e.g. ``, ``, ``. + +### Special characters with modifiers + +`` and `` are keyword forms for `-` and `+` when combined with a +modifier (e.g. `` for Ctrl+`-`). Without modifiers, write `-` and `+` +directly. `` is the keyword for the space character. + +### Combinations that are rejected + +These look reasonable but can't actually be delivered by a terminal: + +- `` (shift alone on a rune) — terminals fold shift into the rune itself, + so shift+a arrives as `A`. Write `A` instead. +- ``, ``, etc. (modifier on an uppercase ASCII letter) — write + `` instead. + +### Terminal compatibility + +Support for combinations of modifiers, and in general keybindings beyond plain +letters and ctrl+letter, require a newer terminal protocol that not all +terminals support. + +Terminals that are known to have good support include: Ghostty, kitty, +WezTerm, foot, Konsole, Alacritty, iTerm2, Windows Terminal. + +The default terminal on macOS (Terminal.app) does not; I recommend to switch to +either Ghostty or iTerm2 as a replacement (or one of the others above). + +On Windows, a popular terminal is the MinTTY console that comes with Git for +Windows; this also doesn't support the newer protocol. The recommended +replacement is Windows Terminal, which is very good these days, and Git Bash +runs just fine in it. + +Inside **tmux** or **screen**, extended keys are stripped unless the multiplexer +is configured to forward them. For tmux 3.2+: + +​` +set -g extended-keys on +set -as terminal-features 'xterm*:extkeys' +​`