User guide / Custom key bindings

Binding actions

Development reference · View source

Completion popup actions can be assigned separately from Insert/Replace editing:

keys:
  ui:
    completion:
      next: [Ctrl-j]
      previous: [Ctrl-k]
      accept: [Ctrl-y]

Each action list replaces all its default bindings. [] removes them; omitted actions retain defaults. UI actions are independent of keys.defaults. Configuration fragments merge by owner and action. A conflict with another effective action restores the owner’s defaults with a diagnostic.

Completion actionDefault keysEffect
nextDown, Ctrl-nSelect the next candidate
previousUp, Ctrl-pSelect the previous candidate
acceptTabInsert the selected candidate
cancelCtrl-cDismiss and consume the key
cancel-or-continueEscDismiss; word completion and directory buffers pass the key to ordinary editing
dismiss-and-continueEnterDismiss and pass the key to ordinary editing

The continuation actions pass the actual pressed key once, including its modifiers. If remapped to F9, they run the underlying F9 binding, not the old Esc/Enter binding. They never synthesize input. UI bindings currently accept single strokes, with up to 32 aliases per action. Configured modifiers match exactly using the same character Shift normalization as editor bindings. Unchanged defaults retain their existing handling of additional modifiers.

The context-actions, path-actions, and program-actions owners support next, previous, accept, and cancel. Context and path actions default to Down/j, Up/k/Shift-Tab, Enter, and Tab/Esc/Ctrl-c respectively. Program actions use Down/Ctrl-n and Up/Ctrl-p/Shift-Tab for navigation, Enter to accept, and Tab/Esc/Ctrl-c to cancel. The path popup supports open-actions (Tab) and cancel (Esc/Ctrl-c). These menu owners also inherit the effective leader as a cancel key. Reassigning or removing cancel removes that leader binding too.

The nested buffer-actions, terminal-actions, and session-actions owners support next, previous, accept, back, and cancel. Their navigation uses Down/Ctrl-n and Up/Ctrl-p/Shift-Tab; Enter accepts, Tab goes back, and Esc/Ctrl-c cancels. Both back and cancel close the menu. They are separate actions because back, like acceptance, refuses a stale selected row; cancel can always dismiss that stale menu. This distinction follows the actions when remapped. These owners also inherit leader cancellation. Replacing cancel leaves back available; replace or remove both actions to change every dismissal key.

For terminal and session actions requiring a second confirmation, the configured accept key both arms and confirms. Navigation disarms the confirmation; an unbound key does not. Acceptance still revalidates the captured target and requires the current presented frame where that gate applies.

The plugin-manager-actions owner provides a transparent cancel action that returns from the plugin action list to the manager, preserving its filter and selection. Escape, Ctrl-c, and the empty-filter leader are its defaults. Other input continues through global.list. This return action takes precedence over scoped bindings in that list; hints and acceptance authority use the same order. Replacing or removing return bindings exposes any underlying scoped action: for example, removing this owner’s cancel makes Escape perform list-close unless you also change Escape in global.list. Removing its inherited leader restores literal filter input without an implicit Escape translation.

The confirmation owner supports accept and cancel for file and directory reloads, buffer and Git discard, and pull/rebase confirmation. Defaults are Enter and Esc/Ctrl-c. stash-confirmation has the same actions but defaults to Enter and Esc; Ctrl-c remains inert there. Both inherit leader cancellation only where the existing overlay allows it (for example, an underlying nonempty filter suppresses it). Replacing cancel also replaces inherited leader cancellation. A remapped acceptance still revalidates the captured file, repository, or other target, and requires the current presented frame wherever that check applies.

The text-confirmation owner handles branch switching/deletion and worktree removal. It supports accept, cancel, backspace, delete, move-left, move-right, move-start, and move-end. Editing defaults are Backspace, Delete, Left, Right, Home, and End; prompt-style Ctrl-h/Ctrl-a aliases are not inherited. Text and pasted names remain structural input. Remapping acceptance does not bypass an exact-name requirement or change the authorization required by the captured operation. Untyped branch/worktree decisions use the same owner, but their editing actions remain inactive.

The filesystem-confirmation owner supports accept, cancel, next, previous, page-up, page-down, first, and last. Enter applies the reviewed plan with trash deletion; Esc/Ctrl-c cancel. Navigation defaults are Down/Ctrl-n, Up/Ctrl-p, PageDown/Ctrl-d, PageUp/Ctrl-u, Home, and End. Plain P remains the structural permanent-deletion choice; Shift-P does not confirm it. An inherited leader takes precedence over that choice, and the hint reflects that precedence. Plugin-owned plans retain their host execution and captured approval checks.

The tree-destination owner supports accept (Enter), cancel (Esc), and backspace. Plain pane digits remain structural and still select immediately when they identify one captured pane. tree-delete supports cancel (Enter or Esc); y/Y and n/N remain structural yes/no choices. Default tree-delete keys accept Shift/Meta/Hyper but ignore Control/Alt/Super; configured cancellation matches its exact authored modifiers. Neither tree owner adds a Ctrl-c alias. Both preserve conditional leader cancellation and captured targets.

Merge-review controls use keys.scopes.git-merge-review, git-merge-detail, and git-merge-input. Acknowledgment editing uses ui.merge-acknowledgment with backspace, delete, move-left, and move-right. Literal text remains structural. Editing preserves the pending scoped key sequence and the existing cursor behavior. Removing an editing alias permits that key to be assigned in git-merge-input; configurations cannot advertise a scoped action hidden by an active editing binding.

ui.merge-prefix.reset-and-continue defaults to Escape with any modifiers. It clears the pending review sequence, then resolves the same input through the scoped keymap. Other default cancellation aliases do not interrupt an unfinished sequence. Replacing or removing this action permits Escape inside configured review sequences. A reset key owned by the scoped input layer cannot be used after the first stroke of a sequence. Literal text and acknowledgment editing take precedence over prefix reset. Outside acknowledgment editing, the leader keeps its existing alias to the scoped Escape binding.

Plugin input uses separate owners for each interaction:

OwnerActions
plugin-confirmationaccept, cancel
plugin-pickeraccept, cancel, next, previous, backspace
plugin-formaccept, cancel, next, previous, backspace, delete, move-left, move-right, move-start, move-end
plugin-choiceaccept, cancel, next, previous, move-left, move-right, toggle-selection
plugin-path-completionaccept, accept-or-continue, next, previous

These owners do not inherit leader cancellation. Form text and picker filters remain literal input. Choice fields use plain Left/Right and Space by default; Space is the configurable toggle-selection action there. Text fields retain Space as text. Picker Backspace removes one character; form editing retains its grapheme-aware cursor and deletion behavior.

Path completion takes precedence only while candidates are available. accept defaults to Tab; accept-or-continue defaults to Enter and completes an unfinished path, otherwise allowing the form to handle Enter. Completion Up/Down cycle candidates; modified navigation falls through to the form. Repeating Tab may complete a path, while repeating conditional completion or submission cannot submit a form. Remapped submission retains fresh-input, presented-frame, field-validation, and captured-context checks. Completion cannot lend submission authority to another input owner.

The provider-reload owner supports next, previous, accept, and cancel; provider-overwrite supports accept and cancel. Both retain fresh physical approval and captured document checks. Reload defaults to plain Down/Tab and Up, exact Ctrl-n/Ctrl-p, and any-modifier BackTab; Shift-Tab remains inert. Enter accepts, Esc or exact Ctrl-c cancels, and the leader also cancels. When Enter is the leader, reload cancels while overwrite accepts, preserving its original precedence. Repeated acceptance cannot approve either dialog.

The context-review owner controls permission-review navigation: next, previous, toggle-selection, accept, cancel, first, last, page-up, page-down, half-page-up, and half-page-down. Choice defaults are Down, Up, Tab/Shift-Tab/BackTab, Enter, and Esc. Scrolling inherits the approved normal-mode editor motions, with plain Home/End fallbacks. Configuring a scrolling action replaces its inherited motions as well; an empty list disables them. Removed motion sequences remain consumed so they cannot become permission choices. The single-key permission choices (1/2, r, x, n) remain structural. Remapped acceptance still requires fresh physical input and a fully presented review.

The session-directory and session-inventory owners handle direct session navigation independently of global.list. They support next, previous, page-up, page-down, first, last, accept, cancel, and backspace. Directory navigation also supports enter-directory: Tab browses into the selected directory, while Enter opens it as a workspace. Inventory Tab has no action. These owners preserve literal filter text and do not inherit leader cancellation. Inventory cancellation returns to the session list with its selection preserved; directory cancellation restores the preceding editor mode. Report hints show only the available return action.

keys:
  ui:
    context-actions:
      next: [Ctrl-n]
      previous: [Ctrl-p]
    path:
      open-actions: [F9]
    program-actions:
      accept: [F8]
      cancel: [F9]
    path-actions:
      cancel: [F7]

Menu letters remain structural choices. Context menus reserve plain alphabetic choice keys other than j/k; path actions reserve r and s with any modifiers, preserving their existing choice handling. An inherited leader keeps its old cancellation precedence even if it matches a menu choice or navigation key. Changing cancel restores the covered key’s ordinary meaning. Hints show only currently reachable shortcuts. Cancel in path actions returns to the path popup; cancel there closes it.

Prompt owners are command-prompt (the command palette), text-prompt (search, rename, settings and other text entry), path-prompt (Finder path and directory-tree Move), and program-prompt (Open with). They do not inherit leader cancellation: literal characters, including spaces, remain text.

All prompt owners support accept, cancel, save, move-left, move-right, move-start, move-end, word-left, word-right, delete-backward, delete-forward, delete-word-backward, delete-to-start, delete-to-end, and backspace. The defaults retain Ctrl-c/s/b/f/a/e, Alt-b/f, Ctrl-h/d/w/u/k, and Backspace respectively. backspace resets completion selection; delete-backward (Ctrl-h) preserves it. Non-command prompts additionally support delete (Delete), which resets completion selection; delete-forward (Ctrl-d) preserves it. The command palette’s physical Delete key remains unbound by default.

Command, path and program prompts support next (Down) and previous (Up/Shift-Tab). Command prompts also support first/last (Home/End) and complete (Tab). Path prompts support complete (Tab); program prompts support open-actions (Tab). Home/End in other prompts move the text cursor. Plain characters and literal control characters cannot be assigned as prompt actions. Defaults preserve their existing modifier rules; configured keys match exactly.

keys:
  ui:
    command-prompt:
      accept: [F9]
      complete: [Ctrl-Space]
    text-prompt:
      cancel: [F10]

Accepting a command from an explicitly configured key retains the same native handoff eligibility as fresh Enter. Repeated or replayed input cannot acquire that authority. Existing modified-Enter defaults retain their original limits.

The file-picker and finder owners support accept, cancel, next, previous, page-up, page-down, first, last, move-left, move-right, move-start, move-end, backspace, delete-backward, delete, delete-word-backward, delete-to-end, split-horizontal, split-vertical, and toggle-preview. finder also supports toggle-mode (plain Tab). File-picker Tab aliases next; modified Tab in Finder remains unbound. The existing Ctrl-s/Ctrl-v shortcuts open files horizontally/vertically; splits remain unavailable for buffer and terminal rows.

These owners inherit leader cancellation only while the query is empty. Once text exists, the leader resumes its configured ordinary meaning. Replacing or removing cancel removes the inherited leader shortcut too. Literal filter characters remain structural input. Picker delete-backward (Ctrl-h) retains its existing ranking-publication behavior; backspace defers held ranking results until an action reads them.

keys:
  ui:
    finder:
      accept: [F8]
      toggle-mode: [F9]
      toggle-preview: [F10]
    file-picker:
      split-horizontal: [Ctrl-F8]
      split-vertical: [Alt-F8]

Pane drag gestures can be changed independently of keyboard bindings:

keys:
  pointer:
    pane-extend: [Ctrl-Alt-LeftDrag]
    # pane-move: [Alt-LeftDrag]     # default
    # pane-extend: [Shift-Alt-LeftDrag] # default

Each list replaces all gestures for that action; [] disables the action’s pointer bindings. Omitted actions retain their defaults, including with keys.defaults: false. Modifiers match exactly. Pane gestures accept LeftDrag, MiddleDrag, and RightDrag, with optional Ctrl-, Alt-, Shift-, Super-, Hyper-, or Meta- modifiers. Shared pane borders retain resizing priority. The action is captured when the button is pressed and lasts through release, even when the modifiers or configuration change. Conflicting or invalid pane bindings retain both default pane gestures and produce a configuration diagnostic. Contextual help shows the effective gestures. Configuration fragments merge pointer by action; a later action list replaces the earlier list.

The same section exposes other editor-owned pointer actions:

ActionsAccepted gesturesDefault behavior
select, extendLeftDrag, MiddleDrag, RightDragLeft selects; Shift-left extends the existing anchor
pane-resize, tree-resizeButton dragsLeft drag on the corresponding border
open-linkLeftClick, MiddleClick, RightClickCtrl-left in the native window; Super-left on macOS
copyButton clicksRight click inside the current selection copies it
scroll-up, scroll-down, scroll-left, scroll-rightWheelUp, WheelDown, WheelLeft, WheelRightMatching direction, three cells per host event
tree-selectButton clicksLeft click selects the presented tree row
tree-openLeftDoubleClick, MiddleDoubleClick, RightDoubleClickTwo left clicks on the same presented row open it
session-activateButton clicksLeft click activates the presented session-strip entry
media-pan, media-region, media-auto-selectButton dragsMiddle/right or Alt-left pans; Shift-left selects a region; ordinary left selects PDF text, a wordless PDF region, or pans an image
media-toggle-zoomButton double clicksOrdinary left double-click toggles image fit/zoom where automatic selection would pan
media-zoom, media-horizontal, media-scrollWheelCtrl/Super zooms, otherwise Shift scrolls horizontally, otherwise pans or changes PDF pages at fit size
preview-selectButton dragsLeft selects text in a native document preview; an inactive preview first receives focus
preview-zoom, preview-horizontal, preview-scrollWheelCtrl/Super zooms, otherwise Shift scrolls horizontally, otherwise ordinary two-axis scrolling
input-overflow-dismissButton clicksLeft click dismisses the native input-loss banner

Drag bindings start on button-down and retain their button and target until release. Click bindings act on button-down. Prefix any gesture with the same exact modifiers as pane gestures. Defaults for ordinary clicks, resizing, and wheel movement accept all modifiers; default selection distinguishes Shift. An authored alias always matches only its written modifiers.

keys:
  pointer:
    select: [LeftDrag]
    extend: [Ctrl-LeftDrag]
    open-link: [Alt-MiddleClick]
    tree-open: [MiddleDoubleClick]

Selection and extension compete in one group, pane move and extension in another, and the four wheel directions in a third. Replace conflicting lists together; inheriting a conflicting alias is an error. An invalid group retains its defaults without discarding valid mappings in other groups. Each action accepts at most 192 aliases. Unknown action names reject the pointer section.

Hit regions retain their precedence. Resizing owns matching border presses, pane gestures precede content actions, and link opening precedes live terminal mouse reporting. Inside the active selection, copying takes priority over selection; elsewhere the selection gesture can still place a caret. For unconditional right-button selection, configure select: [RightDrag] together with copy: []. Live terminal SGR reports retain their original physical buttons, modifiers, and wheel directions. Native media and preview gestures have their own input ownership.

Native wheel bindings use continuous Wheel input, preserving trackpad deltas and zoom pivots. They do not use the host’s directional wheel steps. Media drag actions compete in one group, media wheel actions in another, and preview wheel actions in a third. For example:

keys:
  pointer:
    media-pan: [MiddleDrag]
    media-region: [RightDrag]
    media-auto-select: [LeftDrag]
    media-zoom: [Alt-Wheel]
    media-horizontal: [Shift-Wheel]
    media-scroll: [Wheel]
    preview-select: [MiddleDrag]

Actions in one group may not share a gesture. When they do, Runyte reports the overlap and keeps the whole group’s defaults, so a list that claims a gesture another action of the group holds by default must reassign that action too. Ctrl- and Super-wheel belong to preview-zoom by default; a preview-scroll or preview-horizontal list written before preview zoom existed that names them now needs a preview-zoom list of its own.

Native surfaces consume removed gestures rather than passing them to hidden source text. The factory preview right-click retains source-selection copying; replacing or removing preview-select also suppresses that fallback. A captured drag stays with its pane, page and document source; replacement or dismissal cancels the action while consuming its trailing release. Pane gestures still take priority. Remapped native drags follow their initiating button; effective factory gestures retain their existing multi-button behavior.

Old-frame presses and wheel events are rejected after configuration reload. A drag already in progress keeps its captured action. Contextual help displays the effective pointer bindings, including removed actions as unbound.

Ctrl-Alt-LeftDrag avoids terminals that reserve Shift for native selection. The terminal or window manager still needs to deliver the configured gesture.

keys.bind has one map per mode: normal, select, insert, and replace. Each maps a key sequence to one of four values:

ValueMeaningExample
action nameRun one action.X: extend-line-above
listRun several actions in order.F6: [select-all, yank]
{ command, argument }Run a command with an argument.F7: { command: pipe, argument: sort }
nullRemove 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.