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?
{
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
const shortcut = {
keys: ['Escape', 'Escape'],
type: 'burst',
commands: [{ name: 'CancelSendEntry' }, { name: 'ScrollViewport' }],
};
getTerminalsShortcuts
Retrieves all terminals shortcuts.
Usage
const getTerminalsShortcuts = selectorsHelper.make('getTerminalsShortcuts');
getTerminalsShortcuts(getState());
-
state Object
Required. The global state of the application.
Returns
-
[Shortcuts]
Array with all the shortcuts.
Example
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.
Usage
dispatchersHelper.dispatch('createTerminalsShortcuts', { shortcut: Object });
-
shortcut Object
Required. The shortcut to be created.
Example
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.
Usage
dispatchersHelper.dispatch('replaceTerminalsShortcut', { shortcut: Object });
-
shortcut Object
Required. The shortcut to be modified.
Example
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.
Usage
dispatchersHelper.dispatch('deleteTerminalsShortcut', { keys: [String] });
-
keys [String]
Required. The keys of the shortcut to be modified.
Example
const keys = ['KeyR'];
dispatchersHelper.dispatch('deleteTerminalsShortcut', { keys });