Terminal Shortcuts

This section is for the terminal shortcuts, a shortcut is used to capture the user keystrokes and run commands according to them.

What is a shortcut?

Copy
{
keys: [String, String],
type: 'burst' | 'chain',
commands: [
  { name: 'CancelSendEntry' },
  { name: 'ScrollViewport' },
 ],
};

A shortcut is composed by:

  • keys [String]

    A list of keys that compose the shortcut

  • type 'burst' | 'chain'

    Define how the shortcut sequence is matched. "Chain" should match a sequence of pressed keys in a determined order. "Burst" should match the sequence of pressed keys in order and in a determined interval between keys.

  • commands Array

    The list of commands to be executed when the shortcut is matched.

Example
Copy
const shortcut = {
  keys: ['Escape', 'Escape'],
  type: 'burst',
  commands: [{ name: 'CancelSendEntry' }, { name: 'ScrollViewport' }],
};

getTerminalsShortcuts

Retrieves all terminals shortcuts.

Usage
Copy
const getTerminalsShortcuts = selectorsHelper.make('getTerminalsShortcuts');
getTerminalsShortcuts(getState());
  • state Object

    Required. The global state of the application.

Returns
  • [Shortcuts]

    Array with all the shortcuts.

Example
Copy
const getTerminalsShortcuts = selectorsHelper.make('getTerminalsShortcuts');
getTerminalsShortcuts(getState());

createTerminalsShortcuts

Makes a new shortcut if it does not exist yet. If the shortcut already exists, it does nothing.

Note: Dispatches an action with the type @orion/terminals-helper/CREATE_TERMINALS_SHORTCUT which can be handled.
Usage
Copy
dispatchersHelper.dispatch('createTerminalsShortcuts', { shortcut: Object });
  • shortcut Object

    Required. The shortcut to be created.

Example
Copy
const shortcut = {
keys: ['KeyL'],
type: 'burst',
commands: [{ name: 'MoveCursorRight' }],
};
dispatchersHelper.dispatch('createTerminalsShortcuts', { shortcut });

replaceTerminalsShortcut

Modifies an existing shortcut. If the shortcut does not exists, it does nothing.

Note: Dispatches an action with the type @orion/terminals-helper/REPLACE_TERMINALS_SHORTCUT which can be handled.
Usage
Copy
dispatchersHelper.dispatch('replaceTerminalsShortcut', { shortcut: Object });
  • shortcut Object

    Required. The shortcut to be modified.

Example
Copy
const shortcut = {
keys: ['A-KeyR'],
type: 'chain',
commands: [{ name: 'MoveCursorRight' }],
};
dispatchersHelper.dispatch('replaceTerminalsShortcut', { shortcut });

deleteTerminalsShortcut

Deletes an existing shortcut. If the shortcut does not exists, it does nothing.

Note: Dispatches an action with the type @orion/terminals-helper/DELETE_TERMINALS_SHORTCUT which can be handled.
Usage
Copy
dispatchersHelper.dispatch('deleteTerminalsShortcut', { keys: [String] });
  • keys [String]

    Required. The keys of the shortcut to be modified.

Example
Copy
const keys = ['KeyR'];
dispatchersHelper.dispatch('deleteTerminalsShortcut', { keys });