Binding actions
Development reference · View source
keys.bind has one map per mode: normal, select, insert, and
replace. Each maps a key sequence to one of four values:
| Value | Meaning | Example |
|---|---|---|
| action name | Run one action. | X: extend-line-above |
| list | Run several actions in order. | F6: [select-all, yank] |
{ command, argument } | Run a command with an argument. | F7: { command: pipe, argument: sort } |
null | Remove the binding in this mode. | F8: null |
Action names are the hyphenated names in the
reference
. An action does not need a default key
to be bindable. Any action or colon command can also be named the way the
command palette names it, such as theme for open-theme-settings or help
for show-help.
Not everything is bindable: internal transitions, retired grammar commands, unsupported actions, and list-only actions are excluded.
A complete example:
keys:
leader: Ctrl-x
rebind:
Space g: Leader G
bind:
normal:
X: extend-line-above
Alt-x: select-line-up
F6: [select-all, yank]
F7: { command: pipe, argument: sort }
F8: null
select:
X: extend-line-above
insert:
Ctrl-s: save
Modes are independent. A binding in normal does nothing in select, and
insert and replace do not inherit from each other. Repeat a binding in
each mode where you want it.
Arguments use the command palette’s own parsing rules.
- A structured value can also appear inside a list.
- Commands with a required argument must be given one.
- Actions do not gain new arguments by being bindable.