Skip to content

Binding Field default

The default field describes a series of hierarchical defaults according to a period-delimited set of identifiers.

Example

toml
[[default]]
id = "motion"
default.mode = "normal"

[[default]]
id = "motion.cursor"
command = "cursorMove"

[[bind]]
name = "lines"
description = "expand selection to full-line selections"
key = "shift+l"
command = "expandLineSelection"
defaults = "motion"
# mode = "normal" (because of the "motion" defaults)

[[bind]]
key = "l"
name = "left"
defaults = "motion.cursor"
# mode = "normal" (because of the "motion" defaults)
# command = "cursorMove" (because of the "motion.cursor" defaults)
args.to = "left"

When you specify the defaults of a keybinding it draws not only from the exact id, but also any of its period-delimited prefixes. Prefixes match when the same set of identifiers in the same order occurs up until the end of the prefix: substrings are not matched. For example foo.bar.baz matches foo.bar and foo but it does not match foo.ba. In the above example, motion.cursor matches both motion and motion.cursor path definitions.

The following fields are available.

  • id is a period-delimited set of identifiers that describe this default; each identifier can include letters, numbers as well as _ and -.

  • default: contains all of the same fields as bind, but they are all optional here. These are propagated to any keybindings associated with this default.

  • appendWhen: this when clause is appended to the when clause of all associated keybindings using (when) && (appendWhen), and must therefore be true for any associated keybindings to trigger.