Terminal Keyboard Mappings

This section is related to the keyboard mappings.

Introduction

The keyboard mappings are a conjunct of character conversions that happen in the terminal when typing, and are related to the host and the keyboardMode.

Default keyboard mappings

Example

createTerminalsKeyboardMapping

Makes a new keyboard Mapping theme if it does not exist yet. If it already exists, it does nothing.

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

    Required. The keyboard mapping to be created.

Example
Copy
const keyboardMapping = {
id: 'testKeyboardMapping',
name: 'testKeyboardMapping',
characterConversions: [
{
character: 'j',
replacement: 'Y',
},
],
};
dispatchersHelper.dispatch('createTerminalsKeyboardMapping', {
keyboardMapping,
});

replaceTerminalKeyboardMappingId

Changes the current keyboardMapping of a terminal.

Note: Dispatches an action with the type @orion/terminals-helper/REPLACE_TERMINAL_KEYBOARD_MAPPING_ID which can be handled.
Usage
Copy
dispatchersHelper.dispatch('replaceTerminalKeyboardMappingId', {
keyboardMappingId: String,
terminalId: String,
});
  • keyboardMappingId String

    Required. The ID of the keyboard mapping.

  • terminalId String

    The ID of the terminal that we want to modify.

Example
Copy
const keyboardMappingId = 'testKeyboardMapping';
const terminalId = 'terminal-1';
dispatchersHelper.dispatch('replaceTerminalKeyboardMappingId', {
keyboardMappingId,
terminalId,
});

getTerminalsKeyboardMappings

Returns all the keyboardMappings.

Copy
getTerminalsKeyboardMappings(state: Object): Object;
  • state Object

    Required. The global state of the application.

Returns
  • Object

    All the keyboard mappings.

Example
Copy
const state = storeHelper.getState();
const getTerminalsKeyboardMappings = selectorsHelper.make('getTerminalsKeyboardMappings');
const keyboardMappings = getTerminalsKeyboardMappings(state);

getTerminalKeyboardMappingId

Given a terminalId, returns the id of the KeyboardMapping applied to it.

Copy
getTerminalKeyboardMappingId(state: Object, { terminalId: String }): String;
  • state Object

    Required. The global state of the application.

  • terminalId String

    Required. The terminal from which we want to retrieve the keyboard mapping.

Returns
  • String

    The ID of the KeyboardMapping of the specified terminal.

Example
Copy
const state = storeHelper.getState();
const terminalId = 'terminal-1';
const getTerminalKeyboardMappingId = selectorsHelper.make('getTerminalKeyboardMappingId');
const keyboardMappingId = getTerminalKeyboardMappingId(state, { terminalId });

getTerminalsKeyboardMapping

Given a keyboardMappingId, returns the KeyboardMapping object.

Usage
Copy
getTerminalsKeyboardMapping(state: Object, { keyboardMappingId: String }): Object;
  • state Object

    Required. The global state of the application.

  • keyboardMappingId String

    Required. The ID of the KeyboardMapping that we want to retrieve.

Returns
  • Object

    The keyboardMapping object.

Example
Copy
const state = storeHelper.getState();
const keyboardMappingId = 'mapping-1';
const getTerminalsKeyboardMapping = selectorsHelper.make('getTerminalsKeyboardMapping');
const keyboardMapping = getTerminalsKeyboardMapping(state, { keyboardMappingId });

getTerminalsKeyboardMappingsIds

Return an array with all the keyboard mappings IDs.

Usage
Copy
getTerminalsKeyboardMappingsIds(state: Object): [String];
  • state Object

    Required. The global state of the application.

Returns
  • String

    Array with all the keyboardMappings.

Example
Copy
const state = storeHelper.getState();
const getTerminalsKeyboardMappingsIds = selectorsHelper.make('getTerminalsKeyboardMappingsIds');
const keyboardMappingsIds = getTerminalsKeyboardMapping(state);