Skip to content

Expressions

There are a number of places where you can use expressions when defining a keybinding. Any field that is evaluated as an expression includes the word computed in its name. The expressions are AngularJS expressions. When an expression is evaluated the following values are in scope:

  • Any field defined in the top-level define field
  • Any value set by setFlag
  • editorHasSelection: true if there is any selection, false otherwise
  • editorHasMultipleSelections: true if there are multiple selections, false otherwise
  • firstSelectionOrWord: the first selection, or the word under the first cursor if the selection is empty
  • editorLangId: the language id of the current editor or the empty string if there is no current editor (or no language id for that editor)
  • mode: the current keybinding mode
  • count: The current count, as defined by master-key.updateCount
  • captured: The text currently captured by the most recent call to master-key.restoreNamed or master-key.captureKeys.
  • prefix: The currently active keybinding prefix
  • record: a boolean flag used to indicate when keys are marked for recording
  • commandHistory: an array containing all previously run master key commands, up to the number configured by Master Key's "Command History Maximum" (defaults to 1024). Commands are stored from least recent (smallest index) to most recent (largest index).