Skip to content

Commit

Permalink
Force lowercase for key identifiers and add supported keys to doc
Browse files Browse the repository at this point in the history
  • Loading branch information
chabou committed Feb 11, 2017
1 parent 0654ea9 commit 6da2a91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins: [

## Configuration

Default configuration:
### Default configuration:
``` js
module.exports = {
config: {
Expand Down Expand Up @@ -47,22 +47,29 @@ module.exports = {
//...
};
```
### Supported keys
Supported keys are the same than for [Mousetrap](https://craig.is/killing/mice).

For modifier keys you can use `shift`, `ctrl`, `alt`, or `meta`. You can substitute `option` for `alt` and `command` for `meta`.

Other special keys are `backspace`, `tab`, `enter`, `return`, `capslock`, `esc`, `escape`, `space`, `pageup`, `pagedown`, `end`, `home`, `left`, `up`, `right`, `down`, `ins`, `del`, and `plus`.

Any other key you should be able to reference by name like `a`, `/`, `$`, `*`, or `=`.

## Usage
### Navigation with arrows

Use `Ctrl+Alt+<Up,Down,Left,Right>` (or your configured hotkeys) to navigate to a neighbor pane.
Use `ctrl+alt+<Up,Down,Left,Right>` (or your configured hotkeys) to navigate to a neighbor pane.

### Jump with digit

Use `Ctrl+Alt+<1-9>` (or your configured hotkeys) to jump directly to a numbered pane.
Use `ctrl+alt+<1-9>` (or your configured hotkeys) to jump directly to a numbered pane.
Panes are ordered "first child descendent" and `9` is reserved to the last pane.

Hotkey indicators are displayed on top left corner of each pane from 2 panes opened.
You can change its content, its style or hide them completly.

### Pane permutation

Adding `Shift` key (or your configured key) to previous hotkeys cause a pane switching.
Adding `shift` key (or your configured key) to previous hotkeys cause a pane switching.

6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ exports.decorateTerms = (Terms, { React, notify, Notification }) => {
const document = term.getTermDocument();
const keys = new Mousetrap(document);

const jump_prefix = config.hotkeys.jump_prefix;
const permutation_modifier = config.hotkeys.permutation_modifier;
const jump_prefix = config.hotkeys.jump_prefix.toLowerCase();
const permutation_modifier = config.hotkeys.permutation_modifier.toLowerCase();
if (jump_prefix && jump_prefix.length) {
['1','2','3','4','5','6','7','8','9'].forEach(num => {
let shortcut = jump_prefix+ `+${num}`;
Expand Down Expand Up @@ -447,7 +447,7 @@ exports.decorateTerms = (Terms, { React, notify, Notification }) => {
}

Object.keys(config.hotkeys.navigation).forEach(direction => {
const key = config.hotkeys.navigation[direction];
const key = config.hotkeys.navigation[direction].toLowerCase();
const actionType = navigationActionMap[direction];
if (key && key.length && actionType && actionType.length) {
keys.bind(
Expand Down

0 comments on commit 6da2a91

Please sign in to comment.