diff options
author | Shinya Ohyanagi <heavenshell.jp@gmail.com> | 2017-11-15 22:42:09 +0900 |
---|---|---|
committer | Shinya Ohyanagi <heavenshell.jp@gmail.com> | 2017-11-15 22:42:09 +0900 |
commit | b1d186b66216106329f1301e29892c1cac0fd9d2 (patch) | |
tree | f550b1fb30f22bf1d576ec78f864214952bab765 /src/console | |
parent | a50c7dd0a20cbef8860c3592ae70d3813d94b78d (diff) |
Add c-n, c-p, c-m to console
Add `c-n`, `c-j` for select next item.
Add `c-p`, `c-k` for select previous item.
Add `c-m` for select item.
Above console keybinds are same as Vim(Vimperator)'s completion
selector.
Diffstat (limited to 'src/console')
-rw-r--r-- | src/console/components/console.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/console/components/console.js b/src/console/components/console.js index 7bc3364..cabd229 100644 --- a/src/console/components/console.js +++ b/src/console/components/console.js @@ -48,6 +48,34 @@ export default class ConsoleComponent { e.stopPropagation(); e.preventDefault(); break; + case KeyboardEvent.DOM_VK_OPEN_BRACKET: + if (e.ctrlKey) { + return this.hideCommand(); + } + break; + case KeyboardEvent.DOM_VK_M: + if (e.ctrlKey) { + e.stopPropagation(); + e.preventDefault(); + return this.onEntered(e.target.value); + } + break; + case KeyboardEvent.DOM_VK_N: + case KeyboardEvent.DOM_VK_J: + if (e.ctrlKey) { + this.store.dispatch(consoleActions.completionNext()); + e.stopPropagation(); + e.preventDefault(); + } + break; + case KeyboardEvent.DOM_VK_P: + case KeyboardEvent.DOM_VK_K: + if (e.ctrlKey) { + this.store.dispatch(consoleActions.completionPrev()); + e.stopPropagation(); + e.preventDefault(); + } + break; } } |