From c4cc76e9f6a0a99ebc297e420be739a0fc77f827 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 5 Nov 2017 07:49:13 +0000 Subject: Add more named keys (version 2) This allows any special key to mapped, simply by using the `event.key` key name. E.g. map scrollDown Replaces #2770. Fixes #2769. --- lib/keyboard_utils.coffee | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee index 681ee139..8cd2a490 100644 --- a/lib/keyboard_utils.coffee +++ b/lib/keyboard_utils.coffee @@ -5,7 +5,7 @@ Utils?.monitorChromeStorage "mapKeyRegistry", (value) => mapKeyRegistry = value KeyboardUtils = # This maps event.key key names to Vimium key names. keyNames: - "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space", "Backspace": "backspace" + "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space" init: -> if (navigator.userAgent.indexOf("Mac") != -1) @@ -38,10 +38,8 @@ KeyboardUtils = "" else if key.length == 1 key - else if key.length == 2 and "F1" <= key <= "F9" - key.toLowerCase() # F1 to F9. - else if key.length == 3 and "F10" <= key <= "F12" - key.toLowerCase() # F10 to F12. + else if 1 < key.length + key.toLowerCase() else "" -- cgit v1.2.3 From 87f017e48aa04ecc44dc06c1e4c35ffc5ecf611f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 5 Nov 2017 11:17:34 +0000 Subject: Note new mappable keys. --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1896a662..5e0d18d7 100644 --- a/README.md +++ b/README.md @@ -141,9 +141,10 @@ The following special keys are available for mapping: - ``, ``, `` for ctrl, alt, and meta (command on Mac) respectively with any key. Replace `*` with the key of choice. -- ``, ``, ``, `` for the arrow keys -- `` and `` for the space and backspace keys -- `` through `` for the function keys +- ``, ``, ``, `` for the arrow keys. +- `` through `` for the function keys. +- `` for the space key. +- ``, ``, ``, ``, ``, `` and `` for the corresponding non-printable keys (version 1.62 onwards). Shifts are automatically detected so, for example, `` corresponds to ctrl+shift+7 on an English keyboard. @@ -171,6 +172,7 @@ Release Notes In `master` (not yet released) - Backup and restore Vimium options (see the very bottom of the options page, below *Advanced Options*). +- It is now possible to map ``, ``, ``, ``, `` and ``. 1.61 (2017-10-27) -- cgit v1.2.3